Loading api/current.xml +11 −0 Original line number Diff line number Diff line Loading @@ -31851,6 +31851,17 @@ visibility="public" > </field> <field name="ACTION_POWER_USAGE_SUMMARY" type="java.lang.String" transient="false" volatile="false" value=""android.intent.action.POWER_USAGE_SUMMARY"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_PROVIDER_CHANGED" type="java.lang.String" transient="false" core/java/android/content/Intent.java +9 −0 Original line number Diff line number Diff line Loading @@ -1076,6 +1076,15 @@ public class Intent implements Parcelable { */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_APP_ERROR = "android.intent.action.APP_ERROR"; /** * Activity Action: Show power usage information to the user. * <p>Input: Nothing. * <p>Output: Nothing. */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_POWER_USAGE_SUMMARY = "android.intent.action.POWER_USAGE_SUMMARY"; // --------------------------------------------------------------------- // --------------------------------------------------------------------- // Standard intent broadcast actions (see action variable). Loading core/res/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1302,6 +1302,9 @@ <string name="battery_low_percent_format">less than <xliff:g id="number">%d%%</xliff:g> remaining.</string> <!-- When the battery is low, this is the label of the button to go to the power usage activity to find out what drained the battery. --> <string name="battery_low_why">Why?</string> <!-- Title of the alert when something went wrong in the factory test. --> <string name="factorytest_failed">Factory test failed</string> Loading services/java/com/android/server/status/StatusBarPolicy.java +17 −0 Original line number Diff line number Diff line Loading @@ -729,6 +729,23 @@ public class StatusBarPolicy { b.setIcon(android.R.drawable.ic_dialog_alert); b.setPositiveButton(android.R.string.ok, null); final Intent intent = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_NO_HISTORY); if (intent.resolveActivity(mContext.getPackageManager()) != null) { b.setNegativeButton(com.android.internal.R.string.battery_low_why, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { mContext.startActivity(intent); if (mLowBatteryDialog != null) { mLowBatteryDialog.dismiss(); } } }); } AlertDialog d = b.create(); d.setOnDismissListener(mLowBatteryListener); d.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); Loading Loading
api/current.xml +11 −0 Original line number Diff line number Diff line Loading @@ -31851,6 +31851,17 @@ visibility="public" > </field> <field name="ACTION_POWER_USAGE_SUMMARY" type="java.lang.String" transient="false" volatile="false" value=""android.intent.action.POWER_USAGE_SUMMARY"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_PROVIDER_CHANGED" type="java.lang.String" transient="false"
core/java/android/content/Intent.java +9 −0 Original line number Diff line number Diff line Loading @@ -1076,6 +1076,15 @@ public class Intent implements Parcelable { */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_APP_ERROR = "android.intent.action.APP_ERROR"; /** * Activity Action: Show power usage information to the user. * <p>Input: Nothing. * <p>Output: Nothing. */ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_POWER_USAGE_SUMMARY = "android.intent.action.POWER_USAGE_SUMMARY"; // --------------------------------------------------------------------- // --------------------------------------------------------------------- // Standard intent broadcast actions (see action variable). Loading
core/res/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1302,6 +1302,9 @@ <string name="battery_low_percent_format">less than <xliff:g id="number">%d%%</xliff:g> remaining.</string> <!-- When the battery is low, this is the label of the button to go to the power usage activity to find out what drained the battery. --> <string name="battery_low_why">Why?</string> <!-- Title of the alert when something went wrong in the factory test. --> <string name="factorytest_failed">Factory test failed</string> Loading
services/java/com/android/server/status/StatusBarPolicy.java +17 −0 Original line number Diff line number Diff line Loading @@ -729,6 +729,23 @@ public class StatusBarPolicy { b.setIcon(android.R.drawable.ic_dialog_alert); b.setPositiveButton(android.R.string.ok, null); final Intent intent = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_NO_HISTORY); if (intent.resolveActivity(mContext.getPackageManager()) != null) { b.setNegativeButton(com.android.internal.R.string.battery_low_why, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { mContext.startActivity(intent); if (mLowBatteryDialog != null) { mLowBatteryDialog.dismiss(); } } }); } AlertDialog d = b.create(); d.setOnDismissListener(mLowBatteryListener); d.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); Loading