public final void setMaxPriority ( int pri ) { int ngroupsSnapshot ; ThreadGroup [ ] groupsSnapshot ; synchronized ( this ) { checkAccess ( ) ; // Android-changed: Clamp to MIN_PRIORITY, MAX_PRIORITY. // if (pri < Thread.MIN_PRIORITY || pri > Thread.MAX_PRIORITY) { // return; // } if ( pri < Thread . MIN_PRIORITY ) { pri = Thread . MIN_PRIORITY ; } if ( pri > Thread . MAX_PRIORITY ) { pri = Thread . MAX_PRIORITY ; } maxPriority = ( parent != null ) ? Math . min ( pri , parent . maxPriority ) : pri ; ngroupsSnapshot = ngroups ; if ( groups != null ) { groupsSnapshot = Arrays . copyOf ( groups , ngroupsSnapshot ) ; } else { groupsSnapshot = null ; } } for ( int i = 0 ; i < ngroupsSnapshot ; i ++ ) { groupsSnapshot [ i ] . setMaxPriority ( pri ) ; } }
before using it .