Fix Auto click (dwell timing) the checked option isn't the same as the option before upgrading the OS

Root cause:
After OS upgrade to R, the original logic only check SP key but does not consider the setting enabled key to cause it cannot not show correctly.

Next:
1) accessibility_autoclick_enabled=1 but does not have SP key, customize layout is checked and show the right value
2) accessibility_autoclick_enabled=1 and have SP key, show according items is checked
3) accessibility_autoclick_enabled=0, off button is checked

Bug: 151123423
Test: local test
Change-Id: I9ebcbb35ee0071dbf8c969d0a70ea6293f4c6edb
This commit is contained in:
menghanli
2020-04-16 22:33:06 +08:00
committed by Menghan Li
parent 1f91111c3a
commit 771163f0d3
2 changed files with 20 additions and 20 deletions

View File

@@ -153,7 +153,7 @@ public class ToggleAutoclickCustomSeekbarController extends BasePreferenceContro
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (KEY_DELAY_MODE.equals(key)) {
int delayMillis = getSharedPreferenceForDelayValue();
final int delayMillis = getSharedPreferenceForDelayValue();
updateCustomDelayValue(delayMillis);
}
}
@@ -172,10 +172,11 @@ public class ToggleAutoclickCustomSeekbarController extends BasePreferenceContro
}
private int getSharedPreferenceForDelayValue() {
int delayMillis = mSharedPreferences.getInt(KEY_CUSTOM_DELAY_VALUE,
final int delayMillis = Settings.Secure.getInt(mContentResolver,
Settings.Secure.ACCESSIBILITY_AUTOCLICK_DELAY,
AccessibilityManager.AUTOCLICK_DELAY_DEFAULT);
return delayMillis;
return mSharedPreferences.getInt(KEY_CUSTOM_DELAY_VALUE, delayMillis);
}
private void putSecureInt(String name, int value) {
@@ -190,14 +191,14 @@ public class ToggleAutoclickCustomSeekbarController extends BasePreferenceContro
}
private void minusDelayByImageView() {
int delayMillis = getSharedPreferenceForDelayValue();
final int delayMillis = getSharedPreferenceForDelayValue();
if (delayMillis > MIN_AUTOCLICK_DELAY_MS) {
updateCustomDelayValue(delayMillis - AUTOCLICK_DELAY_STEP);
}
}
private void plusDelayByImageView() {
int delayMillis = getSharedPreferenceForDelayValue();
final int delayMillis = getSharedPreferenceForDelayValue();
if (delayMillis < MAX_AUTOCLICK_DELAY_MS) {
updateCustomDelayValue(delayMillis + AUTOCLICK_DELAY_STEP);
}