Cherish: Add QS System Info
Change-Id: I8575808c00a43bde146e6208e0ce9c9320721dcb Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
@@ -650,5 +650,28 @@
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
</string-array>
|
||||
|
||||
<!-- QS SystemInfo -->
|
||||
<string-array name="qs_system_info_entries">
|
||||
<item>@string/qs_system_info_off</item>
|
||||
<item>@string/qs_system_info_cpu_temp</item>
|
||||
<item>@string/qs_system_info_battery_temp</item>
|
||||
<item>@string/qs_system_info_gpu_clock</item>
|
||||
<item>@string/qs_system_info_gpu_busy</item>
|
||||
</string-array>
|
||||
<string-array name="qs_system_info_values" translatable="false">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="qs_system_info_checks">
|
||||
<item>android:string/config_sysCPUTemp</item>
|
||||
<item>android:string/config_sysBatteryTemp</item>
|
||||
<item>android:string/config_sysGPUFreq</item>
|
||||
<item>android:string/config_sysGPULoad</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -827,4 +827,14 @@
|
||||
<string name="settings_home_style_summary">Use stock aosp layout for homepage</string>
|
||||
<string name="disable_usercard_title">Settings UserCard</string>
|
||||
<string name="disable_usercard_summary">Toggle in order not to show the usercard on main settings page</string>
|
||||
|
||||
<string name="qs_header_category_title">QS Header</string>
|
||||
|
||||
<!-- QS SystemInfo -->
|
||||
<string name="qs_system_info_title">System Info</string>
|
||||
<string name="qs_system_info_off">Off</string>
|
||||
<string name="qs_system_info_cpu_temp">CPU temperature</string>
|
||||
<string name="qs_system_info_battery_temp">Battery temperature</string>
|
||||
<string name="qs_system_info_gpu_clock">GPU frequency</string>
|
||||
<string name="qs_system_info_gpu_busy">GPU utilization</string>
|
||||
</resources>
|
||||
|
||||
@@ -83,6 +83,19 @@
|
||||
android:entryValues="@array/quick_pulldown_values"
|
||||
android:defaultValue="0" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="qs_header_category"
|
||||
android:title="@string/qs_header_category_title">
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingIntListPreference
|
||||
android:key="qs_system_info"
|
||||
android:title="@string/qs_system_info_title"
|
||||
android:entries="@array/qs_system_info_entries"
|
||||
android:entryValues="@array/qs_system_info_values"
|
||||
android:defaultValue="0"
|
||||
android:summary="%s" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
|
||||
@@ -17,6 +17,7 @@ import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import com.cherish.settings.preferences.CustomSeekBarPreference;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import java.util.Locale;
|
||||
@@ -37,11 +38,15 @@ import java.util.ArrayList;
|
||||
public class QuickSettings extends SettingsPreferenceFragment implements
|
||||
OnPreferenceChangeListener {
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private static final String QS_FOOTER_TEXT_STRING = "qs_footer_text_string";
|
||||
private static final String SYSTEM_INFO = "qs_system_info";
|
||||
|
||||
private SystemSettingEditTextPreference mFooterString;
|
||||
|
||||
private ListPreference mQuickPulldown;
|
||||
private ListPreference mSysInfo;
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
@@ -103,6 +108,31 @@ public class QuickSettings extends SettingsPreferenceFragment implements
|
||||
return MetricsProto.MetricsEvent.CHERISH_SETTINGS;
|
||||
}
|
||||
|
||||
private void configureSystemInfo() {
|
||||
Resources res = getResources();
|
||||
String[] entriesArray = res.getStringArray(R.array.qs_system_info_entries);
|
||||
String[] valuesArray = res.getStringArray(R.array.qs_system_info_values);
|
||||
String[] checksArray = res.getStringArray(R.array.qs_system_info_checks);
|
||||
List<String> entries = new ArrayList<>();
|
||||
List<String> values = new ArrayList<>();
|
||||
|
||||
entries.add(entriesArray[0]);
|
||||
values.add(valuesArray[0]);
|
||||
int count = valuesArray.length;
|
||||
for (int i = 1 ; i < count ; i++) {
|
||||
int resID = res.getIdentifier(checksArray[i-1], "string", "android");
|
||||
if (DEBUG) Log.d("systemInfo", "resID= " + resID);
|
||||
if (resID > 0 && !res.getString(resID).isEmpty()) {
|
||||
if (DEBUG) Log.d("systemInfo", "sysPath= " + res.getString(resID));
|
||||
entries.add(entriesArray[i]);
|
||||
values.add(valuesArray[i]);
|
||||
}
|
||||
}
|
||||
mSysInfo.setEntries(entries.toArray(new String[entries.size()]));
|
||||
mSysInfo.setEntryValues(values.toArray(new String[values.size()]));
|
||||
if (entries.size() < 2) mSysInfo.getParent().removePreference(mSysInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* For Search.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user