Update PowerNotificationWarnings
Test: manual Fixes: 160969580 Change-Id: I451338d8fcad71d1e3d95cbc08808d76f8b7d991
This commit is contained in:
@@ -2422,17 +2422,26 @@
|
||||
|
||||
<!-- Title for notification & dialog that the user's phone last shut down because it got too hot. [CHAR LIMIT=40] -->
|
||||
<string name="thermal_shutdown_title">Phone turned off due to heat</string>
|
||||
<!-- Message body for notification that user's phone last shut down because it got too hot. [CHAR LIMIT=100] -->
|
||||
<string name="thermal_shutdown_message">Your phone is now running normally</string>
|
||||
<!-- Text body for dialog alerting user that their phone last shut down because it got too hot. [CHAR LIMIT=450] -->
|
||||
<!-- Message body for notification that user's phone last shut down because it got too hot. [CHAR LIMIT=120] -->
|
||||
<string name="thermal_shutdown_message">Your phone is now running normally.\nTap for more info</string>
|
||||
<!-- Text body for dialog alerting user that their phone last shut down because it got too hot. [CHAR LIMIT=500] -->
|
||||
<string name="thermal_shutdown_dialog_message">Your phone was too hot, so it turned off to cool down. Your phone is now running normally.\n\nYour phone may get too hot if you:\n\t• Use resource-intensive apps (such as gaming, video, or navigation apps)\n\t• Download or upload large files\n\t• Use your phone in high temperatures</string>
|
||||
<!-- Text help link for care instructions for overheating devices [CHAR LIMIT=40] -->
|
||||
<string name="thermal_shutdown_dialog_help_text">See care steps</string>
|
||||
<!-- URL for care instructions for overheating devices -->
|
||||
<string name="thermal_shutdown_dialog_help_url" translatable="false"></string>
|
||||
|
||||
<!-- Title for notification (and dialog) that user's phone has reached a certain temperature and may start to slow down in order to cool down. [CHAR LIMIT=30] -->
|
||||
<string name="high_temp_title">Phone is getting warm</string>
|
||||
<!-- Message body for notification that user's phone has reached a certain temperature and may start to slow down in order to cool down. [CHAR LIMIT=100] -->
|
||||
<string name="high_temp_notif_message">Some features limited while phone cools down</string>
|
||||
<!-- Text body for dialog alerting user that their phone has reached a certain temperature and may start to slow down in order to cool down. [CHAR LIMIT=300] -->
|
||||
<!-- Message body for notification that user's phone has reached a certain temperature and may start to slow down in order to cool down. [CHAR LIMIT=120] -->
|
||||
<string name="high_temp_notif_message">Some features limited while phone cools down.\nTap for more info</string>
|
||||
<!-- Text body for dialog alerting user that their phone has reached a certain temperature and may start to slow down in order to cool down. [CHAR LIMIT=350] -->
|
||||
<string name="high_temp_dialog_message">Your phone will automatically try to cool down. You can still use your phone, but it may run slower.\n\nOnce your phone has cooled down, it will run normally.</string>
|
||||
<!-- Text help link for care instructions for overheating devices [CHAR LIMIT=40] -->
|
||||
<string name="high_temp_dialog_help_text">See care steps</string>
|
||||
<!-- URL for care instructions for overheating devices -->
|
||||
<string name="high_temp_dialog_help_url" translatable="false"></string>
|
||||
|
||||
<!-- Title for alarm dialog alerting user the usb adapter has reached a certain temperature that should disconnect charging cable immediately. [CHAR LIMIT=30] -->
|
||||
<string name="high_temp_alarm_title">Unplug charger</string>
|
||||
<!-- Text body for dialog alerting user the usb adapter has reached a certain temperature that should disconnect charging cable immediately. [CHAR LIMIT=300] -->
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.content.ActivityNotFoundException;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.media.AudioAttributes;
|
||||
@@ -376,13 +377,15 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
|
||||
return;
|
||||
}
|
||||
mHighTempWarning = true;
|
||||
final String message = mContext.getString(R.string.high_temp_notif_message);
|
||||
final Notification.Builder nb =
|
||||
new Notification.Builder(mContext, NotificationChannels.ALERTS)
|
||||
.setSmallIcon(R.drawable.ic_device_thermostat_24)
|
||||
.setWhen(0)
|
||||
.setShowWhen(false)
|
||||
.setContentTitle(mContext.getString(R.string.high_temp_title))
|
||||
.setContentText(mContext.getString(R.string.high_temp_notif_message))
|
||||
.setContentText(message)
|
||||
.setStyle(new Notification.BigTextStyle().bigText(message))
|
||||
.setVisibility(Notification.VISIBILITY_PUBLIC)
|
||||
.setContentIntent(pendingBroadcast(ACTION_CLICKED_TEMP_WARNING))
|
||||
.setDeleteIntent(pendingBroadcast(ACTION_DISMISSED_TEMP_WARNING))
|
||||
@@ -402,6 +405,23 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
|
||||
d.setPositiveButton(com.android.internal.R.string.ok, null);
|
||||
d.setShowForAllUsers(true);
|
||||
d.setOnDismissListener(dialog -> mHighTempDialog = null);
|
||||
final String url = mContext.getString(R.string.high_temp_dialog_help_url);
|
||||
if (!url.isEmpty()) {
|
||||
d.setNeutralButton(R.string.high_temp_dialog_help_text,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final Intent helpIntent =
|
||||
new Intent(Intent.ACTION_VIEW)
|
||||
.setData(Uri.parse(url))
|
||||
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
Dependency.get(ActivityStarter.class).startActivity(helpIntent,
|
||||
true /* dismissShade */, resultCode -> {
|
||||
mHighTempDialog = null;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
d.show();
|
||||
mHighTempDialog = d;
|
||||
}
|
||||
@@ -420,19 +440,38 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
|
||||
d.setPositiveButton(com.android.internal.R.string.ok, null);
|
||||
d.setShowForAllUsers(true);
|
||||
d.setOnDismissListener(dialog -> mThermalShutdownDialog = null);
|
||||
final String url = mContext.getString(R.string.thermal_shutdown_dialog_help_url);
|
||||
if (!url.isEmpty()) {
|
||||
d.setNeutralButton(R.string.thermal_shutdown_dialog_help_text,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
final Intent helpIntent =
|
||||
new Intent(Intent.ACTION_VIEW)
|
||||
.setData(Uri.parse(url))
|
||||
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
Dependency.get(ActivityStarter.class).startActivity(helpIntent,
|
||||
true /* dismissShade */, resultCode -> {
|
||||
mThermalShutdownDialog = null;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
d.show();
|
||||
mThermalShutdownDialog = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showThermalShutdownWarning() {
|
||||
final String message = mContext.getString(R.string.thermal_shutdown_message);
|
||||
final Notification.Builder nb =
|
||||
new Notification.Builder(mContext, NotificationChannels.ALERTS)
|
||||
.setSmallIcon(R.drawable.ic_device_thermostat_24)
|
||||
.setWhen(0)
|
||||
.setShowWhen(false)
|
||||
.setContentTitle(mContext.getString(R.string.thermal_shutdown_title))
|
||||
.setContentText(mContext.getString(R.string.thermal_shutdown_message))
|
||||
.setContentText(message)
|
||||
.setStyle(new Notification.BigTextStyle().bigText(message))
|
||||
.setVisibility(Notification.VISIBILITY_PUBLIC)
|
||||
.setContentIntent(pendingBroadcast(ACTION_CLICKED_THERMAL_SHUTDOWN_WARNING))
|
||||
.setDeleteIntent(
|
||||
|
||||
Reference in New Issue
Block a user