Cleaning up deprecated QS tooltip code
Flag is rolled out, so tooltips other than font size shouldn't show anymore. Much code can be removed. Flag: EXEMPT code cleanup Test: atest com.android.settings.accessibility Bug: 367414968 Change-Id: I55084982fee0d0537aade49d36f52e121e24574b
This commit is contained in:
@@ -21,7 +21,6 @@ import static com.android.internal.accessibility.common.ShortcutConstants.UserSh
|
||||
import static com.android.settings.accessibility.AccessibilityDialogUtils.DialogEnums;
|
||||
import static com.android.settings.accessibility.AccessibilityUtil.getShortcutSummaryList;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.ComponentName;
|
||||
@@ -85,8 +84,6 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
||||
public static final String KEY_SHORTCUT_PREFERENCE = "shortcut_preference";
|
||||
protected static final String KEY_TOP_INTRO_PREFERENCE = "top_intro";
|
||||
protected static final String KEY_HTML_DESCRIPTION_PREFERENCE = "html_description";
|
||||
protected static final String KEY_SAVED_QS_TOOLTIP_RESHOW = "qs_tooltip_reshow";
|
||||
protected static final String KEY_SAVED_QS_TOOLTIP_TYPE = "qs_tooltip_type";
|
||||
protected static final String KEY_ANIMATED_IMAGE = "animated_image";
|
||||
// For html description of accessibility service, must follow the rule, such as
|
||||
// <img src="R.drawable.fileName"/>, a11y settings will get the resources successfully.
|
||||
@@ -112,10 +109,6 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
||||
private CharSequence mDescription;
|
||||
private TouchExplorationStateChangeListener mTouchExplorationStateChangeListener;
|
||||
private AccessibilitySettingsContentObserver mSettingsContentObserver;
|
||||
|
||||
private AccessibilityQuickSettingsTooltipWindow mTooltipWindow;
|
||||
private boolean mNeedsQSTooltipReshow = false;
|
||||
private int mNeedsQSTooltipType = QuickSettingsTooltipType.GUIDE_TO_EDIT;
|
||||
private ImageView mImageGetterCacheView;
|
||||
protected final Html.ImageGetter mImageGetter = (String str) -> {
|
||||
if (str != null && str.startsWith(IMG_PREFIX)) {
|
||||
@@ -133,16 +126,6 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
onProcessArguments(getArguments());
|
||||
// Restore the user shortcut type and tooltip.
|
||||
if (savedInstanceState != null) {
|
||||
if (savedInstanceState.containsKey(KEY_SAVED_QS_TOOLTIP_RESHOW)) {
|
||||
mNeedsQSTooltipReshow = savedInstanceState.getBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW);
|
||||
}
|
||||
if (savedInstanceState.containsKey(KEY_SAVED_QS_TOOLTIP_TYPE)) {
|
||||
mNeedsQSTooltipType = savedInstanceState.getInt(KEY_SAVED_QS_TOOLTIP_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
final int resId = getPreferenceScreenResId();
|
||||
if (resId <= 0) {
|
||||
final PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(
|
||||
@@ -227,16 +210,6 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
||||
final SettingsMainSwitchBar switchBar = settingsActivity.getSwitchBar();
|
||||
switchBar.hide();
|
||||
|
||||
// Reshow tooltip when activity recreate, such as rotate device.
|
||||
if (mNeedsQSTooltipReshow) {
|
||||
view.post(() -> {
|
||||
final Activity activity = getActivity();
|
||||
if (activity != null && !activity.isFinishing()) {
|
||||
showQuickSettingsTooltipIfNeeded();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
writeConfigDefaultAccessibilityServiceIntoShortcutTargetServiceIfNeeded(getContext());
|
||||
}
|
||||
|
||||
@@ -261,24 +234,10 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
final boolean isTooltipWindowShowing = mTooltipWindow != null && mTooltipWindow.isShowing();
|
||||
if (mNeedsQSTooltipReshow || isTooltipWindowShowing) {
|
||||
outState.putBoolean(KEY_SAVED_QS_TOOLTIP_RESHOW, /* value= */ true);
|
||||
outState.putInt(KEY_SAVED_QS_TOOLTIP_TYPE, mNeedsQSTooltipType);
|
||||
}
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
removeActionBarToggleSwitch();
|
||||
final boolean isTooltipWindowShowing = mTooltipWindow != null && mTooltipWindow.isShowing();
|
||||
if (isTooltipWindowShowing) {
|
||||
mTooltipWindow.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -314,7 +273,12 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
||||
/** Returns the accessibility tile component name. */
|
||||
abstract ComponentName getTileComponentName();
|
||||
|
||||
/** Returns the accessibility tile tooltip content. */
|
||||
/** Returns the accessibility tile component name.
|
||||
*
|
||||
* @deprecated unused, as this class no longer displays tile tooltips.
|
||||
*
|
||||
* (TODO 367414968: finish removal.)*/
|
||||
@Deprecated
|
||||
abstract CharSequence getTileTooltipContent(@QuickSettingsTooltipType int type);
|
||||
|
||||
protected void updateToggleServiceTitle(SettingsMainSwitchPreference switchPreference) {
|
||||
@@ -332,9 +296,6 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
||||
}
|
||||
|
||||
protected void onPreferenceToggled(String preferenceKey, boolean enabled) {
|
||||
if (enabled) {
|
||||
showQuickSettingsTooltipIfNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
protected void onInstallSwitchPreferenceToggleSwitch() {
|
||||
@@ -646,7 +607,6 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
||||
*/
|
||||
private void callOnTutorialDialogButtonClicked(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
showQuickSettingsTooltipIfNeeded();
|
||||
}
|
||||
|
||||
protected void updateShortcutPreferenceData() {
|
||||
@@ -737,26 +697,6 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the quick settings tooltip if the quick settings feature is assigned. The tooltip only
|
||||
* shows once.
|
||||
*
|
||||
* @param type The quick settings tooltip type
|
||||
*/
|
||||
protected void showQuickSettingsTooltipIfNeeded(@QuickSettingsTooltipType int type) {
|
||||
mNeedsQSTooltipType = type;
|
||||
showQuickSettingsTooltipIfNeeded();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated made obsolete by quick settings rollout.
|
||||
*
|
||||
* (TODO 367414968: finish removal.)
|
||||
*/
|
||||
@Deprecated
|
||||
private void showQuickSettingsTooltipIfNeeded() {
|
||||
}
|
||||
|
||||
/** Returns user visible name of the tile by given {@link ComponentName}. */
|
||||
protected CharSequence loadTileLabel(Context context, ComponentName componentName) {
|
||||
final PackageManager packageManager = context.getPackageManager();
|
||||
|
||||
Reference in New Issue
Block a user