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

Commit a331bbd5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove the click action for battery header"

parents f8caf69d e5a42769
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@

    <com.android.settings.applications.LayoutPreference
        android:key="battery_header"
        android:selectable="true"
        android:selectable="false"
        android:layout="@layout/battery_header"/>

    <PreferenceCategory
+2 −36
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ import java.util.List;
 * consumed since the last time it was unplugged.
 */
public class PowerUsageSummary extends PowerUsageBase implements OnLongClickListener,
        OnClickListener, BatteryTipPreferenceController.BatteryTipListener {
        BatteryTipPreferenceController.BatteryTipListener {

    static final String TAG = "PowerUsageSummary";

@@ -80,7 +80,6 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
    private static final String KEY_APP_LIST = "app_list";
    private static final String KEY_BATTERY_HEADER = "battery_header";
    private static final String KEY_BATTERY_TIP = "battery_tip";
    private static final String KEY_SHOW_ALL_APPS = "show_all_apps";

    private static final String KEY_SCREEN_USAGE = "screen_usage";
    private static final String KEY_TIME_SINCE_LAST_FULL_CHARGE = "last_full_charge";
@@ -224,15 +223,6 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
        return MetricsEvent.FUELGAUGE_POWER_USAGE_SUMMARY_V2;
    }

    @Override
    public boolean onPreferenceTreeClick(Preference preference) {
        if (KEY_BATTERY_HEADER.equals(preference.getKey())) {
            performBatteryHeaderClick();
            return true;
        }
        return super.onPreferenceTreeClick(preference);
    }

    @Override
    protected String getLogTag() {
        return TAG;
@@ -311,22 +301,6 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
        }
    }

    private void performBatteryHeaderClick() {
        if (mPowerFeatureProvider.isAdvancedUiEnabled()) {
            Utils.startWithFragment(getContext(), PowerUsageAdvanced.class.getName(), null,
                    null, 0, R.string.advanced_battery_title, null, getMetricsCategory());
        } else {
            mStatsHelper.storeStatsHistoryInFile(BatteryHistoryDetail.BATTERY_HISTORY_FILE);
            Bundle args = new Bundle(2);
            args.putString(BatteryHistoryDetail.EXTRA_STATS,
                    BatteryHistoryDetail.BATTERY_HISTORY_FILE);
            args.putParcelable(BatteryHistoryDetail.EXTRA_BROADCAST,
                    mStatsHelper.getBatteryBroadcast());
            Utils.startWithFragment(getContext(), BatteryHistoryDetail.class.getName(), args,
                    null, 0, R.string.history_details_title, null, getMetricsCategory());
        }
    }

    protected void refreshUi() {
        final Context context = getContext();
        if (context == null) {
@@ -405,12 +379,9 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
        getLoaderManager().restartLoader(BATTERY_INFO_LOADER, Bundle.EMPTY,
                mBatteryInfoLoaderCallbacks);
        if (mPowerFeatureProvider.isEstimateDebugEnabled()) {
            // Unfortunately setting a long click listener on a view means it will no
            // longer pass the regular click event to the parent, so we have to register
            // a regular click listener as well.
            // Set long click action for summary to show debug info
            View header = mBatteryLayoutPref.findViewById(R.id.summary1);
            header.setOnLongClickListener(this);
            header.setOnClickListener(this);
        }
    }

@@ -421,11 +392,6 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
        return true;
    }

    @Override
    public void onClick(View view) {
        performBatteryHeaderClick();
    }

    @Override
    protected void restartBatteryStatsLoader() {
        restartBatteryStatsLoader(true /* clearHeader */);