Add metric for new battery relative functions for S (1/2)

Reference the table from PM requested:
https://docs.google.com/spreadsheets/d/1TC_6MLVMvOS0p1ic0wPfQ-19AOuY8Kc8FUJdqaQSM4I/edit?ts=6098b296#gid=0

Bug: 188505537
Test: make SettingsRoboTests
Change-Id: I2a4df9ab900cbeaf9885bb2dbc21ea848920bc81
This commit is contained in:
ykhung
2021-05-19 15:33:52 +08:00
committed by YUKAI HUNG
parent 9f24967458
commit a3d3c22a27
6 changed files with 51 additions and 5 deletions

View File

@@ -17,6 +17,7 @@ package com.android.settings.display;
import static android.provider.Settings.System.SHOW_BATTERY_PERCENT;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.provider.Settings;
@@ -28,6 +29,7 @@ import com.android.internal.R;
import com.android.settings.Utils;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.overlay.FeatureFactory;
/**
* A controller to manage the switch for showing battery percentage in the status bar.
@@ -75,6 +77,8 @@ public class BatteryPercentagePreferenceController extends BasePreferenceControl
boolean showPercentage = (Boolean) newValue;
Settings.System.putInt(mContext.getContentResolver(), SHOW_BATTERY_PERCENT,
showPercentage ? 1 : 0);
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider()
.action(mContext, SettingsEnums.OPEN_BATTERY_PERCENTAGE, showPercentage);
return true;
}
}