Refactor nfc preference controller

- Remove BaseNfcPreferenceController.
- NfcPreferenceController inherit from TogglePreferenceController.
- AndroidBeamPreferenceController inherit from BasePreferenceController.
- Override getIntentFilter in NfcPreferenceController to listen changes.
- Add an API (hasAsyncUpdate) into BasePreferenceController to
distinguish the setting which is updated asynchronously.

Change-Id: I1abe4410169e305a0d6106e24c54e7f2e763fc91
Merged-In: I7c9c48ea7f1ad01a02524beabf9d30baa3db891f
Fixes: 67997761
Fixes: 74887543
Test: RunSettingsRoboTests
This commit is contained in:
Chihhang Chuang
2018-03-29 17:26:04 +08:00
parent 5a0a7ef4bb
commit 6719a9b73e
19 changed files with 471 additions and 221 deletions

View File

@@ -106,7 +106,9 @@ public class SliceBroadcastReceiver extends BroadcastReceiver {
if (!controller.isAvailable()) {
Log.w(TAG, "Can't update " + key + " since the setting is unavailable");
updateUri(context, key, isPlatformSlice);
if (!controller.hasAsyncUpdate()) {
updateUri(context, key, isPlatformSlice);
}
return;
}
@@ -115,7 +117,9 @@ public class SliceBroadcastReceiver extends BroadcastReceiver {
final TogglePreferenceController toggleController = (TogglePreferenceController) controller;
toggleController.setChecked(isChecked);
logSliceValueChange(context, key, isChecked ? 1 : 0);
updateUri(context, key, isPlatformSlice);
if (!controller.hasAsyncUpdate()) {
updateUri(context, key, isPlatformSlice);
}
}
private void handleSliderAction(Context context, String key, int newPosition,