Toggle for disabling stylus buttons.
This change enables users to disable stylus button pressed from the Stylus Connected Device details Settings page. Bug: b/251199452 Test: StylusDevicesControllerTest Change-Id: I807ef8d5a56c2177037dcb527630d8bfb8f86f7c
This commit is contained in:
@@ -22,6 +22,7 @@ import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.Secure;
|
||||
import android.util.Log;
|
||||
import android.view.InputDevice;
|
||||
|
||||
@@ -125,6 +126,8 @@ public class StylusDevicesController extends AbstractPreferenceController implem
|
||||
pref.setTitle(mContext.getString(R.string.stylus_ignore_button));
|
||||
pref.setIcon(R.drawable.ic_block);
|
||||
pref.setOnPreferenceClickListener(this);
|
||||
pref.setChecked(Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_BUTTONS_DISABLED, 0) == 1);
|
||||
return pref;
|
||||
}
|
||||
|
||||
@@ -147,7 +150,9 @@ public class StylusDevicesController extends AbstractPreferenceController implem
|
||||
((SwitchPreference) preference).isChecked() ? 1 : 0);
|
||||
break;
|
||||
case KEY_IGNORE_BUTTON:
|
||||
// TODO(b/251199452): to turn off stylus button presses
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Secure.STYLUS_BUTTONS_DISABLED,
|
||||
((SwitchPreference) preference).isChecked() ? 1 : 0);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user