Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd979154 authored by Anh Pham's avatar Anh Pham Committed by Automerger Merge Worker
Browse files

Merge "Move isChangeEnabled() to end of the if statement." into sc-dev am: 74515037

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14186225

Change-Id: Ife050f1a1535b11280e172dcb80fd4e94936019d
parents 36f400ee 74515037
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -571,10 +571,10 @@ public class SystemSensorManager extends SensorManager {
        }

        int sensorHandle = (sensor == null) ? -1 : sensor.getHandle();
        if (Compatibility.isChangeEnabled(CHANGE_ID_SAMPLING_RATE_SENSORS_PERMISSION)
                && rate > CAPPED_SAMPLING_RATE_LEVEL
        if (rate > CAPPED_SAMPLING_RATE_LEVEL
                && mIsPackageDebuggable
                && !mHasHighSamplingRateSensorsPermission) {
                && !mHasHighSamplingRateSensorsPermission
                && Compatibility.isChangeEnabled(CHANGE_ID_SAMPLING_RATE_SENSORS_PERMISSION)) {
            throw new SecurityException("To use the sampling rate level " + rate
                    + ", app needs to declare the normal permission"
                    + " HIGH_SAMPLING_RATE_SENSORS.");
@@ -782,10 +782,10 @@ public class SystemSensorManager extends SensorManager {
                Sensor sensor, int rateUs, int maxBatchReportLatencyUs) {
            if (mNativeSensorEventQueue == 0) throw new NullPointerException();
            if (sensor == null) throw new NullPointerException();
            if (Compatibility.isChangeEnabled(CHANGE_ID_SAMPLING_RATE_SENSORS_PERMISSION)
                    && rateUs < CAPPED_SAMPLING_PERIOD_US
            if (rateUs < CAPPED_SAMPLING_PERIOD_US
                    && mManager.mIsPackageDebuggable
                    && !mManager.mHasHighSamplingRateSensorsPermission) {
                    && !mManager.mHasHighSamplingRateSensorsPermission
                    && Compatibility.isChangeEnabled(CHANGE_ID_SAMPLING_RATE_SENSORS_PERMISSION)) {
                throw new SecurityException("To use the sampling rate of " + rateUs
                        + " microseconds, app needs to declare the normal permission"
                        + " HIGH_SAMPLING_RATE_SENSORS.");