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

Commit 4802b828 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "Change default temp threshold to use shutdown temp" into...

Merge "Merge "Change default temp threshold to use shutdown temp" into oc-dr1-dev am: 84626a4e" into oc-dr1-dev-plus-aosp
parents 3ae1e070 b723d252
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -328,9 +328,13 @@
    <integer name="config_showTemperatureWarning">0</integer>

    <!-- Temp at which to show a warning notification if config_showTemperatureWarning is true.
         If < 0, uses the value from HardwarePropertiesManager#getDeviceTemperatures. -->
         If < 0, uses the value from
         HardwarePropertiesManager#getDeviceTemperatures - config_warningTemperatureTolerance. -->
    <integer name="config_warningTemperature">-1</integer>

    <!-- Fudge factor for how much below the shutdown temp to show the warning. -->
    <integer name="config_warningTemperatureTolerance">2</integer>

    <!-- Accessibility actions -->
    <item type="id" name="action_split_task_to_left" />
    <item type="id" name="action_split_task_to_right" />
+4 −0
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@ import com.android.systemui.plugins.PluginDependencyProvider;
import com.android.systemui.plugins.PluginManager;
import com.android.systemui.plugins.PluginManagerImpl;
import com.android.systemui.plugins.VolumeDialogController;
import com.android.systemui.power.PowerNotificationWarnings;
import com.android.systemui.power.PowerUI;
import com.android.systemui.statusbar.phone.ConfigurationControllerImpl;
import com.android.systemui.statusbar.phone.DarkIconDispatcherImpl;
import com.android.systemui.statusbar.phone.ManagedProfileController;
@@ -296,6 +298,8 @@ public class Dependency extends SystemUI {
        mProviders.put(PluginActivityManager.class,
                () -> new PluginActivityManager(mContext, getDependency(PluginManager.class)));

        mProviders.put(PowerUI.WarningsUI.class, () -> new PowerNotificationWarnings(mContext));

        // Put all dependencies above here so the factory can override them if it wants.
        SystemUIFactory.getInstance().injectDependencies(mProviders, mContext);
    }
+2 −3
Original line number Diff line number Diff line
@@ -104,10 +104,9 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
    private SystemUIDialog mHighTempDialog;
    private SystemUIDialog mThermalShutdownDialog;

    public PowerNotificationWarnings(Context context, NotificationManager notificationManager,
            StatusBar statusBar) {
    public PowerNotificationWarnings(Context context) {
        mContext = context;
        mNoMan = notificationManager;
        mNoMan = mContext.getSystemService(NotificationManager.class);
        mPowerMan = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
        mReceiver.init();
    }
+10 −9
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.systemui.power;

import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
@@ -33,14 +32,17 @@ import android.os.PowerManager;
import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.util.Log;
import android.util.Slog;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.MetricsLogger;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.SystemUI;
import com.android.systemui.statusbar.phone.StatusBar;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.Arrays;
@@ -84,10 +86,7 @@ public class PowerUI extends SystemUI {
        mHardwarePropertiesManager = (HardwarePropertiesManager)
                mContext.getSystemService(Context.HARDWARE_PROPERTIES_SERVICE);
        mScreenOffTime = mPowerManager.isScreenOn() ? -1 : SystemClock.elapsedRealtime();
        mWarnings = new PowerNotificationWarnings(
                mContext,
                (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE),
                getComponent(StatusBar.class));
        mWarnings = Dependency.get(WarningsUI.class);
        mLastConfiguration.setTo(mContext.getResources().getConfiguration());

        ContentObserver obs = new ContentObserver(mHandler) {
@@ -266,13 +265,14 @@ public class PowerUI extends SystemUI {
            // Get the throttling temperature. No need to check if we're not throttling.
            float[] throttlingTemps = mHardwarePropertiesManager.getDeviceTemperatures(
                    HardwarePropertiesManager.DEVICE_TEMPERATURE_SKIN,
                    HardwarePropertiesManager.TEMPERATURE_THROTTLING);
                    HardwarePropertiesManager.TEMPERATURE_SHUTDOWN);
            if (throttlingTemps == null
                    || throttlingTemps.length == 0
                    || throttlingTemps[0] == HardwarePropertiesManager.UNDEFINED_TEMPERATURE) {
                return;
            }
            mThresholdTemp = throttlingTemps[0];
            mThresholdTemp = throttlingTemps[0] -
                    resources.getInteger(R.integer.config_warningTemperatureTolerance);
        }

        setNextLogTime();
@@ -293,7 +293,8 @@ public class PowerUI extends SystemUI {
        }
    }

    private void updateTemperatureWarning() {
    @VisibleForTesting
    protected void updateTemperatureWarning() {
        float[] temps = mHardwarePropertiesManager.getDeviceTemperatures(
                HardwarePropertiesManager.DEVICE_TEMPERATURE_SKIN,
                HardwarePropertiesManager.TEMPERATURE_CURRENT);
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.TRUST_LISTENER" />
    <uses-permission android:name="android.permission.USE_FINGERPRINT" />
    <uses-permission android:name="android.permission.DEVICE_POWER" />

    <application>
        <uses-library android:name="android.test.runner" />
Loading