Doing null check before generating Extra Dim tooltip
Since the lifecycle of controller is independent of that of preference, we do null check on the switch to avoid generating tooltip from the switch when it is not ready. The fix is a temporary solution for the issue and we would like to move the logic of tooltip to systemUI to match the general view's lifecycle in the future. Bug: 286810561 Test: manually - check the tooltip won't be shown and also won't cause exception after rotating the phone. (The switch view has not been created if it is out of screen.) Test: manually - attach video to the bug Test: make RunSettingsRoboTests ROBOTEST_FILTER=AccessibilityQuickSettingsPrimarySwitchPreferenceControllerTest Change-Id: I75d810e4b85baf06d57a3e31797a55daac791b79
This commit is contained in:
@@ -130,10 +130,17 @@ public abstract class AccessibilityQuickSettingsPrimarySwitchPreferenceControlle
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO (287728819): Move tooltip showing to SystemUI
|
||||
// Since the lifecycle of controller is independent of that of the preference, doing
|
||||
// null check on switch is a temporary solution for the case that switch view
|
||||
// is not ready when we would like to show the tooltip. If the switch is not ready,
|
||||
// we give up showing the tooltip and also do not reshow it in the future.
|
||||
if (mPreference.getSwitch() != null) {
|
||||
mTooltipWindow = new AccessibilityQuickSettingsTooltipWindow(mContext);
|
||||
mTooltipWindow.setup(getTileTooltipContent(),
|
||||
R.drawable.accessibility_auto_added_qs_tooltip_illustration);
|
||||
mTooltipWindow.showAtTopCenter(mPreference.getSwitch());
|
||||
}
|
||||
AccessibilityQuickSettingUtils.optInValueToSharedPreferences(mContext, tileComponentName);
|
||||
mNeedsQSTooltipReshow = false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user