Loading packages/SystemUI/src/com/android/systemui/power/PowerUI.java +2 −2 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ public class PowerUI extends SystemUI { private float[] mRecentTemps = new float[MAX_RECENT_TEMPS]; private int mNumTemps; private long mNextLogTime; private IThermalService mThermalService; @VisibleForTesting IThermalService mThermalService; @VisibleForTesting int mBatteryLevel = 100; @VisibleForTesting int mBatteryStatus = BatteryManager.BATTERY_STATUS_UNKNOWN; Loading Loading @@ -394,7 +394,7 @@ public class PowerUI extends SystemUI { // Enable push notifications of throttling from vendor thermal // management subsystem via thermalservice, in addition to our // usual polling, to react to temperature jumps more quickly. IBinder b = ServiceManager.getService("thermalservice"); IBinder b = ServiceManager.getService(Context.THERMAL_SERVICE); if (b != null) { mThermalService = IThermalService.Stub.asInterface(b); Loading packages/SystemUI/tests/src/com/android/systemui/power/PowerUITest.java +8 −4 Original line number Diff line number Diff line Loading @@ -32,12 +32,13 @@ import android.content.Context; import android.content.Intent; import android.os.BatteryManager; import android.os.HardwarePropertiesManager; import android.os.IThermalService; import android.os.PowerManager; import android.provider.Settings; import android.test.suitebuilder.annotation.SmallTest; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper.RunWithLooper; import android.testing.TestableResources; import android.test.suitebuilder.annotation.SmallTest; import com.android.settingslib.utils.ThreadUtils; import com.android.systemui.R; Loading @@ -45,15 +46,16 @@ import com.android.systemui.SysuiTestCase; import com.android.systemui.power.PowerUI.WarningsUI; import com.android.systemui.statusbar.phone.StatusBar; import java.time.Duration; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import java.time.Duration; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @RunWith(AndroidTestingRunner.class) @RunWithLooper @SmallTest Loading @@ -76,6 +78,7 @@ public class PowerUITest extends SysuiTestCase { private PowerUI mPowerUI; private EnhancedEstimates mEnhancedEstimates; @Mock private PowerManager mPowerManager; @Mock private IThermalService mThermalServiceMock; @Before public void setup() { Loading Loading @@ -541,5 +544,6 @@ public class PowerUITest extends SysuiTestCase { mPowerUI = new PowerUI(); mPowerUI.mContext = mContext; mPowerUI.mComponents = mContext.getComponents(); mPowerUI.mThermalService = mThermalServiceMock; } } Loading
packages/SystemUI/src/com/android/systemui/power/PowerUI.java +2 −2 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ public class PowerUI extends SystemUI { private float[] mRecentTemps = new float[MAX_RECENT_TEMPS]; private int mNumTemps; private long mNextLogTime; private IThermalService mThermalService; @VisibleForTesting IThermalService mThermalService; @VisibleForTesting int mBatteryLevel = 100; @VisibleForTesting int mBatteryStatus = BatteryManager.BATTERY_STATUS_UNKNOWN; Loading Loading @@ -394,7 +394,7 @@ public class PowerUI extends SystemUI { // Enable push notifications of throttling from vendor thermal // management subsystem via thermalservice, in addition to our // usual polling, to react to temperature jumps more quickly. IBinder b = ServiceManager.getService("thermalservice"); IBinder b = ServiceManager.getService(Context.THERMAL_SERVICE); if (b != null) { mThermalService = IThermalService.Stub.asInterface(b); Loading
packages/SystemUI/tests/src/com/android/systemui/power/PowerUITest.java +8 −4 Original line number Diff line number Diff line Loading @@ -32,12 +32,13 @@ import android.content.Context; import android.content.Intent; import android.os.BatteryManager; import android.os.HardwarePropertiesManager; import android.os.IThermalService; import android.os.PowerManager; import android.provider.Settings; import android.test.suitebuilder.annotation.SmallTest; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper.RunWithLooper; import android.testing.TestableResources; import android.test.suitebuilder.annotation.SmallTest; import com.android.settingslib.utils.ThreadUtils; import com.android.systemui.R; Loading @@ -45,15 +46,16 @@ import com.android.systemui.SysuiTestCase; import com.android.systemui.power.PowerUI.WarningsUI; import com.android.systemui.statusbar.phone.StatusBar; import java.time.Duration; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import java.time.Duration; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @RunWith(AndroidTestingRunner.class) @RunWithLooper @SmallTest Loading @@ -76,6 +78,7 @@ public class PowerUITest extends SysuiTestCase { private PowerUI mPowerUI; private EnhancedEstimates mEnhancedEstimates; @Mock private PowerManager mPowerManager; @Mock private IThermalService mThermalServiceMock; @Before public void setup() { Loading Loading @@ -541,5 +544,6 @@ public class PowerUITest extends SysuiTestCase { mPowerUI = new PowerUI(); mPowerUI.mContext = mContext; mPowerUI.mComponents = mContext.getComponents(); mPowerUI.mThermalService = mThermalServiceMock; } }