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:
@@ -20,10 +20,8 @@ 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 static com.android.settings.accessibility.ToggleFeaturePreferenceFragment.KEY_GENERAL_CATEGORY;
|
||||
import static com.android.settings.accessibility.ToggleFeaturePreferenceFragment.KEY_SAVED_QS_TOOLTIP_TYPE;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.ComponentName;
|
||||
@@ -44,7 +42,6 @@ import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.internal.accessibility.common.ShortcutConstants;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.accessibility.AccessibilityUtil.QuickSettingsTooltipType;
|
||||
import com.android.settings.accessibility.shortcuts.EditShortcutsPreferenceFragment;
|
||||
import com.android.settings.dashboard.RestrictedDashboardFragment;
|
||||
|
||||
@@ -60,16 +57,12 @@ import java.util.Set;
|
||||
public abstract class AccessibilityShortcutPreferenceFragment extends RestrictedDashboardFragment
|
||||
implements ShortcutPreference.OnClickCallback {
|
||||
private static final String KEY_SHORTCUT_PREFERENCE = "shortcut_preference";
|
||||
protected static final String KEY_SAVED_QS_TOOLTIP_RESHOW = "qs_tooltip_reshow";
|
||||
|
||||
protected ShortcutPreference mShortcutPreference;
|
||||
protected Dialog mDialog;
|
||||
private AccessibilityManager.TouchExplorationStateChangeListener
|
||||
mTouchExplorationStateChangeListener;
|
||||
private AccessibilitySettingsContentObserver mSettingsContentObserver;
|
||||
private AccessibilityQuickSettingsTooltipWindow mTooltipWindow;
|
||||
private boolean mNeedsQSTooltipReshow = false;
|
||||
private int mNeedsQSTooltipType = QuickSettingsTooltipType.GUIDE_TO_EDIT;
|
||||
|
||||
public AccessibilityShortcutPreferenceFragment(String restrictionKey) {
|
||||
super(restrictionKey);
|
||||
@@ -81,26 +74,10 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
||||
/** Returns the accessibility feature name. */
|
||||
protected abstract CharSequence getLabelName();
|
||||
|
||||
/** Returns the accessibility tile component name. */
|
||||
protected abstract ComponentName getTileComponentName();
|
||||
|
||||
/** Returns the accessibility tile tooltip content. */
|
||||
protected abstract CharSequence getTileTooltipContent(@QuickSettingsTooltipType int type);
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// 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(
|
||||
@@ -141,21 +118,6 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
// Reshow tooltip when activity recreate, such as rotate device.
|
||||
if (mNeedsQSTooltipReshow) {
|
||||
view.post(() -> {
|
||||
final Activity activity = getActivity();
|
||||
if (activity != null && !activity.isFinishing()) {
|
||||
showQuickSettingsTooltipIfNeeded();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@@ -177,16 +139,6 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
||||
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 Dialog onCreateDialog(int dialogId) {
|
||||
switch (dialogId) {
|
||||
@@ -289,7 +241,6 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
||||
*/
|
||||
private void callOnTutorialDialogButtonClicked(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
showQuickSettingsTooltipIfNeeded();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -362,26 +313,6 @@ public abstract class AccessibilityShortcutPreferenceFragment extends Restricted
|
||||
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 the user preferred shortcut types or the default shortcut types if not set
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user