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

Commit c1371351 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by The Android Open Source Project
Browse files

am 3d74bb4a: Add "why?" button to low battery dialog.

Merge commit '3d74bb4a'

* commit '3d74bb4a':
  Add "why?" button to low battery dialog.
parents 36adccf7 3d74bb4a
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -35104,6 +35104,17 @@
 visibility="public"
>
</field>
<field name="ACTION_POWER_USAGE_SUMMARY"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;android.intent.action.POWER_USAGE_SUMMARY&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="ACTION_PROVIDER_CHANGED"
 type="java.lang.String"
 transient="false"
+9 −0
Original line number Diff line number Diff line
@@ -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).
+3 −0
Original line number Diff line number Diff line
@@ -1306,6 +1306,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>
+17 −0
Original line number Diff line number Diff line
@@ -708,6 +708,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);