Remove the click action for battery header

Also remove the ripple effect

Change-Id: I28c3dc928816f07a18591c0777b5b2f275715ca2
Fixes: 73018312
Test: Build
This commit is contained in:
jackqdyulei
2018-02-06 18:13:40 -08:00
parent 15312d3505
commit e5a4276912
2 changed files with 3 additions and 37 deletions

View File

@@ -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

View File

@@ -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 */);