Reduce the overhead of historical appops

- Use cheaper round method

Fixes: 164465976
Test: TH
Change-Id: I2c661b94ee4a87f96620bde25b2dfae297dc1f5e
This commit is contained in:
Philip P. Moltmann
2020-09-14 19:49:09 -07:00
parent f747948b6d
commit fcd259d22c

View File

@@ -81,8 +81,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
@@ -5021,8 +5019,7 @@ public class AppOpsManager {
* @hide
*/
public static double round(double value) {
final BigDecimal decimalScale = new BigDecimal(value);
return decimalScale.setScale(0, RoundingMode.HALF_UP).doubleValue();
return Math.floor(value + 0.5);
}
@Override