public boolean checkForRWPaths ( ) { boolean result = false ; String [ ] lines = mountReader ( ) ; if ( lines == null ) { // Could not read, assume false; return false ; } for ( String line : lines ) { // Split lines into parts String [ ] args = line . split ( " " ) ; if ( args . length < 4 ) { // If we don't have enough options per line, skip this and log an error QLog . e ( "Error formatting mount line: " + line ) ; continue ; } String mountPoint = args [ 1 ] ; String mountOptions = args [ 3 ] ; for ( String pathToCheck : Const . pathsThatShouldNotBeWrtiable ) { if ( mountPoint . equalsIgnoreCase ( pathToCheck ) ) { // Split options out and compare against "rw" to avoid false positives for ( String option : mountOptions . split ( "," ) ) { if ( option . equalsIgnoreCase ( "rw" ) ) { QLog . v ( pathToCheck + " path is mounted with rw permissions! " + line ) ; result = true ; break ; } } } } } return result ; }
When you re root you can change the permissions on common system directories this method checks if any of these patha Const . pathsThatShouldNotBeWrtiable are writable .