sm8350-common: parts: Add High Touch Polling Rate
Used to handle our node to force enable Xiaomi's High Touch polling rate mode from kernel
This commit is contained in:
parent
675a14ba3e
commit
4708d51a81
12 changed files with 237 additions and 0 deletions
|
|
@ -73,6 +73,32 @@
|
||||||
android:permission="ThermalService">
|
android:permission="ThermalService">
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".touchsampling.TouchSamplingSettingsActivity"
|
||||||
|
android:label="@string/htsr_enable_title"
|
||||||
|
android:theme="@style/Theme.SubSettingsBase"
|
||||||
|
android:exported="false">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="com.android.settings.action.IA_SETTINGS" />
|
||||||
|
</intent-filter>
|
||||||
|
<meta-data
|
||||||
|
android:name="com.android.settings.category"
|
||||||
|
android:value="com.android.settings.category.ia.display" />
|
||||||
|
<meta-data
|
||||||
|
android:name="com.android.settings.summary"
|
||||||
|
android:resource="@string/htsr_enable_summary" />
|
||||||
|
</activity>
|
||||||
|
<service
|
||||||
|
android:name=".touchsampling.TouchSamplingTileService"
|
||||||
|
android:icon="@drawable/ic_htsr"
|
||||||
|
android:label="@string/htsr_enable_title"
|
||||||
|
android:exported="true"
|
||||||
|
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.service.quicksettings.action.QS_TILE" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".speaker.ClearSpeakerActivity"
|
android:name=".speaker.ClearSpeakerActivity"
|
||||||
android:label="@string/clear_speaker_title">
|
android:label="@string/clear_speaker_title">
|
||||||
|
|
|
||||||
11
parts/res/drawable/ic_htsr.xml
Normal file
11
parts/res/drawable/ic_htsr.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:tint="?android:attr/colorControlNormal">
|
||||||
|
|
||||||
|
<path
|
||||||
|
android:fillColor="#000"
|
||||||
|
android:pathData="M20.22,10l-4.15,0.01c-0.16,-0.01 -0.31,0.02 -0.45,0.08l-0.59,0.26L13.2,6.25c-0.56,-1.26 -2.04,-1.83 -3.3,-1.27s-1.83,2.04 -1.27,3.3l3.3,7.45l-1.87,0.39c-0.19,0.05 -0.99,0.27 -1.36,1.21L8,19.19l6.78,2.67c0.49,0.19 1.05,0.18 1.53,-0.04l5.99,-2.65c0.89,-0.4 1.37,-1.38 1.13,-2.32l-1.36,-5.34C21.85,10.65 21.1,10.04 20.22,10zM21.49,17.34L15.5,20l-4.92,-1.96l4.18,-0.88l-4.3,-9.7c-0.11,-0.25 0,-0.55 0.25,-0.66c0.25,-0.11 0.55,0 0.66,0.25l2.5,5.65l1.61,-0.71L20.13,12L21.49,17.34zM2.06,5.56L1,4.5L4.5,1L8,4.5L6.94,5.56L5.32,3.94C5.11,4.76 5,5.62 5,6.5c0,2.42 0.82,4.65 2.2,6.43L6.13,14C4.49,11.95 3.5,9.34 3.5,6.5c0,-0.92 0.1,-1.82 0.3,-2.68L2.06,5.56z"/>
|
||||||
|
</vector>
|
||||||
|
|
@ -66,4 +66,10 @@
|
||||||
<string name="dc_dimming_enable_summary">Reduces eye strain in low light conditions</string>
|
<string name="dc_dimming_enable_summary">Reduces eye strain in low light conditions</string>
|
||||||
<string name="dc_dimming_enable_summary_not_supported">DC Dimming is currently not supported by the kernel</string>
|
<string name="dc_dimming_enable_summary_not_supported">DC Dimming is currently not supported by the kernel</string>
|
||||||
|
|
||||||
|
<!-- High Touch Polling -->
|
||||||
|
<string name="htsr_title">Touch Responsiveness</string>
|
||||||
|
<string name="htsr_enable_title">Increase Touch Responsiveness</string>
|
||||||
|
<string name="htsr_enable_summary">Increases touch polling rate to decrease latency</string>
|
||||||
|
<string name="htsr_enable_summary_not_supported">Increase Touch Responsiveness is currently not supported by the kernel</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
24
parts/res/xml/htsr_settings.xml
Normal file
24
parts/res/xml/htsr_settings.xml
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2015 The CyanogenMod Project
|
||||||
|
2018-2019 The LineageOS Project
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License"
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<PreferenceScreen
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:title="@string/htsr_title">
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="htsr_enable"
|
||||||
|
android:summary="@string/htsr_enable_summary"
|
||||||
|
android:title="@string/htsr_enable_title" />
|
||||||
|
</PreferenceScreen>
|
||||||
|
|
@ -35,6 +35,8 @@ public class BootCompletedReceiver extends BroadcastReceiver {
|
||||||
private static final String TAG = "XiaomiParts";
|
private static final String TAG = "XiaomiParts";
|
||||||
private static final String DC_DIMMING_ENABLE_KEY = "dc_dimming_enable";
|
private static final String DC_DIMMING_ENABLE_KEY = "dc_dimming_enable";
|
||||||
private static final String DC_DIMMING_NODE = "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/dimlayer_exposure";
|
private static final String DC_DIMMING_NODE = "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/dimlayer_exposure";
|
||||||
|
private static final String HTSR_ENABLE_KEY = "htsr_enable";
|
||||||
|
private static final String HTSR_FILE = "/sys/devices/virtual/touch/touch_dev/bump_sample_rate";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(final Context context, Intent intent) {
|
public void onReceive(final Context context, Intent intent) {
|
||||||
|
|
@ -45,6 +47,10 @@ public class BootCompletedReceiver extends BroadcastReceiver {
|
||||||
ThermalUtils.startService(context);
|
ThermalUtils.startService(context);
|
||||||
RefreshUtils.startService(context);
|
RefreshUtils.startService(context);
|
||||||
|
|
||||||
|
// Touch Sampling
|
||||||
|
boolean HTSREnabled = sharedPrefs.getBoolean(HTSR_ENABLE_KEY, false);
|
||||||
|
FileUtils.writeLine(HTSR_FILE, HTSREnabled ? "1" : "0");
|
||||||
|
|
||||||
// DC Dimming
|
// DC Dimming
|
||||||
FileUtils.enableService(context);
|
FileUtils.enableService(context);
|
||||||
boolean dcDimmingEnabled = sharedPrefs.getBoolean(DC_DIMMING_ENABLE_KEY, false);
|
boolean dcDimmingEnabled = sharedPrefs.getBoolean(DC_DIMMING_ENABLE_KEY, false);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015-2016 The CyanogenMod Project
|
||||||
|
* 2017,2021-2022 The LineageOS Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.lineageos.settings.touchsampling;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity;
|
||||||
|
|
||||||
|
public class TouchSamplingSettingsActivity extends CollapsingToolbarBaseActivity {
|
||||||
|
|
||||||
|
private static final String TAG_HTSR = "touchsampling";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
getFragmentManager().beginTransaction().replace(com.android.settingslib.collapsingtoolbar.R.id.content_frame,
|
||||||
|
new TouchSamplingSettingsFragment(), TAG_HTSR).commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2018 The LineageOS Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.lineageos.settings.touchsampling;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import androidx.preference.Preference;
|
||||||
|
import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||||
|
import androidx.preference.PreferenceFragment;
|
||||||
|
import androidx.preference.SwitchPreferenceCompat;
|
||||||
|
|
||||||
|
import org.lineageos.settings.R;
|
||||||
|
import org.lineageos.settings.utils.FileUtils;
|
||||||
|
|
||||||
|
public class TouchSamplingSettingsFragment extends PreferenceFragment implements
|
||||||
|
OnPreferenceChangeListener {
|
||||||
|
|
||||||
|
private SwitchPreferenceCompat mTouchSamplingPreference;
|
||||||
|
private static final String HTSR_ENABLE_KEY = "htsr_enable";
|
||||||
|
private static final String HTSR_FILE = "/sys/devices/virtual/touch/touch_dev/bump_sample_rate";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||||
|
addPreferencesFromResource(R.xml.htsr_settings);
|
||||||
|
mTouchSamplingPreference = (SwitchPreferenceCompat) findPreference(HTSR_ENABLE_KEY);
|
||||||
|
if (FileUtils.fileExists(HTSR_FILE)) {
|
||||||
|
mTouchSamplingPreference.setEnabled(true);
|
||||||
|
mTouchSamplingPreference.setOnPreferenceChangeListener(this);
|
||||||
|
} else {
|
||||||
|
mTouchSamplingPreference.setSummary(R.string.htsr_enable_summary_not_supported);
|
||||||
|
mTouchSamplingPreference.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
|
if (HTSR_ENABLE_KEY.equals(preference.getKey())) {
|
||||||
|
FileUtils.writeLine(HTSR_FILE, (Boolean) newValue ? "1" : "0");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2024 The LineageOS Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.lineageos.settings.touchsampling;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.service.quicksettings.Tile;
|
||||||
|
import android.service.quicksettings.TileService;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import org.lineageos.settings.utils.FileUtils;
|
||||||
|
|
||||||
|
public class TouchSamplingTileService extends TileService {
|
||||||
|
|
||||||
|
private static final String HTSR_ENABLE_KEY = "htsr_enable";
|
||||||
|
private static final String HTSR_FILE = "/sys/devices/virtual/touch/touch_dev/bump_sample_rate";
|
||||||
|
|
||||||
|
private void updateUI(boolean enabled) {
|
||||||
|
final Tile tile = getQsTile();
|
||||||
|
if (FileUtils.fileExists(HTSR_FILE)) {
|
||||||
|
tile.setState(enabled ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
|
||||||
|
} else {
|
||||||
|
tile.setState(Tile.STATE_UNAVAILABLE);
|
||||||
|
}
|
||||||
|
tile.updateTile();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStartListening() {
|
||||||
|
super.onStartListening();
|
||||||
|
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
updateUI(sharedPrefs.getBoolean(HTSR_ENABLE_KEY, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStopListening() {
|
||||||
|
super.onStopListening();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick() {
|
||||||
|
super.onClick();
|
||||||
|
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
final boolean enabled = !(sharedPrefs.getBoolean(HTSR_ENABLE_KEY, false));
|
||||||
|
FileUtils.writeLine(HTSR_FILE, enabled ? "1" : "0");
|
||||||
|
sharedPrefs.edit().putBoolean(HTSR_ENABLE_KEY, enabled).commit();
|
||||||
|
updateUI(enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -228,6 +228,10 @@ on post-fs-data
|
||||||
chown system system /sys/devices/platform/soc/soc:qcom,dsi-display-primary/hbm_enabled
|
chown system system /sys/devices/platform/soc/soc:qcom,dsi-display-primary/hbm_enabled
|
||||||
chmod 0660 /sys/devices/platform/soc/soc:qcom,dsi-display-primary/hbm_enabled
|
chmod 0660 /sys/devices/platform/soc/soc:qcom,dsi-display-primary/hbm_enabled
|
||||||
|
|
||||||
|
# Allow systemto modify High Touch Sampling Rate
|
||||||
|
chown system system /sys/devices/virtual/touch/touch_dev/bump_sample_rate
|
||||||
|
chmod 0660 /sys/devices/virtual/touch/touch_dev/bump_sample_rate
|
||||||
|
|
||||||
on property:sys.boot_completed=1
|
on property:sys.boot_completed=1
|
||||||
# Enable UFS clock scaling back
|
# Enable UFS clock scaling back
|
||||||
write /sys/bus/platform/devices/1d84000.ufshc/clkscale_enable 1
|
write /sys/bus/platform/devices/1d84000.ufshc/clkscale_enable 1
|
||||||
|
|
|
||||||
1
sepolicy/vendor/file.te
vendored
Normal file
1
sepolicy/vendor/file.te
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
type sysfs_htsr, sysfs_type, fs_type;
|
||||||
3
sepolicy/vendor/file_contexts
vendored
3
sepolicy/vendor/file_contexts
vendored
|
|
@ -34,6 +34,9 @@
|
||||||
/sys/devices/virtual/touch/tp_dev/fod_status u:object_r:vendor_sysfs_udfps:s0
|
/sys/devices/virtual/touch/tp_dev/fod_status u:object_r:vendor_sysfs_udfps:s0
|
||||||
/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint-service\.xiaomi u:object_r:hal_fingerprint_default_exec:s0
|
/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint-service\.xiaomi u:object_r:hal_fingerprint_default_exec:s0
|
||||||
|
|
||||||
|
# HTSR
|
||||||
|
/sys/devices/virtual/touch/touch_dev/bump_sample_rate u:object_r:sysfs_htsr:s0
|
||||||
|
|
||||||
# IR
|
# IR
|
||||||
/dev/lirc[0-9]+ u:object_r:lirc_device:s0
|
/dev/lirc[0-9]+ u:object_r:lirc_device:s0
|
||||||
/vendor/bin/hw/android\.hardware\.ir-service\.xiaomi u:object_r:hal_ir_default_exec:s0
|
/vendor/bin/hw/android\.hardware\.ir-service\.xiaomi u:object_r:hal_ir_default_exec:s0
|
||||||
|
|
|
||||||
4
sepolicy/vendor/system_app.te
vendored
4
sepolicy/vendor/system_app.te
vendored
|
|
@ -4,3 +4,7 @@ allow system_app sysfs_thermal:file rw_file_perms;
|
||||||
# DC Dimming and HBM
|
# DC Dimming and HBM
|
||||||
allow system_app vendor_sysfs_graphics:dir search;
|
allow system_app vendor_sysfs_graphics:dir search;
|
||||||
allow system_app vendor_sysfs_graphics:file { getattr open write };
|
allow system_app vendor_sysfs_graphics:file { getattr open write };
|
||||||
|
|
||||||
|
# HTSR
|
||||||
|
allow system_app sysfs_htsr:file { read write open setattr getattr };
|
||||||
|
allow system_app sysfs_htsr:dir { search open read };
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue