Remove obsoleted code: VolumeShortcutToggleFragmentForSetupWizard

The ag/10232215 checks the APK target SDK to use corresponding fragment to avoid wrong status before these app release to R. The patch can dynamic change Select-To-Speak and Talkback on SUW Welcome Screen. Now, the preload select-To-Speak and Talkback uese SDK T. We can remove the obsoleted code.

Bug: 235458916
Test: make RunSettingsRoboTest
Change-Id: I1e7b9c12bf73a5edcaef8814f55df98b9baf9f5e
This commit is contained in:
menghanli
2022-06-09 19:54:47 +08:00
parent d9f5550681
commit 4cc19665ac
3 changed files with 3 additions and 111 deletions

View File

@@ -17,7 +17,6 @@
package com.android.settings.accessibility;
import static com.android.settings.Utils.getAdaptiveIcon;
import static com.android.settings.accessibility.AccessibilityUtil.AccessibilityServiceFragmentType.VOLUME_SHORTCUT_TOGGLE;
import static com.android.settingslib.widget.TwoTargetPreference.ICON_SIZE_MEDIUM;
import android.accessibilityservice.AccessibilityServiceInfo;
@@ -107,11 +106,9 @@ public class AccessibilitySettingsForSetupWizard extends DashboardFragment
public void onResume() {
super.onResume();
updateAccessibilityServicePreference(mScreenReaderPreference,
SCREEN_READER_PACKAGE_NAME, SCREEN_READER_SERVICE_NAME,
VolumeShortcutToggleScreenReaderPreferenceFragmentForSetupWizard.class.getName());
SCREEN_READER_PACKAGE_NAME, SCREEN_READER_SERVICE_NAME);
updateAccessibilityServicePreference(mSelectToSpeakPreference,
SELECT_TO_SPEAK_PACKAGE_NAME, SELECT_TO_SPEAK_SERVICE_NAME,
VolumeShortcutToggleSelectToSpeakPreferenceFragmentForSetupWizard.class.getName());
SELECT_TO_SPEAK_PACKAGE_NAME, SELECT_TO_SPEAK_SERVICE_NAME);
configureMagnificationPreferenceIfNeeded(mDisplayMagnificationPreference);
}
@@ -170,7 +167,7 @@ public class AccessibilitySettingsForSetupWizard extends DashboardFragment
}
private void updateAccessibilityServicePreference(RestrictedPreference preference,
String packageName, String serviceName, String targetFragment) {
String packageName, String serviceName) {
final AccessibilityServiceInfo info = findService(packageName, serviceName);
if (info == null) {
getPreferenceScreen().removePreference(preference);
@@ -186,9 +183,6 @@ public class AccessibilitySettingsForSetupWizard extends DashboardFragment
final ComponentName componentName =
new ComponentName(serviceInfo.packageName, serviceInfo.name);
preference.setKey(componentName.flattenToString());
if (AccessibilityUtil.getAccessibilityServiceFragmentType(info) == VOLUME_SHORTCUT_TOGGLE) {
preference.setFragment(targetFragment);
}
// Update the extras.
final Bundle extras = preference.getExtras();

View File

@@ -1,51 +0,0 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.accessibility;
import android.app.settings.SettingsEnums;
import android.os.Bundle;
import android.view.View;
/** For accessibility services that target SDK <= Q in setup wizard. */
public class VolumeShortcutToggleScreenReaderPreferenceFragmentForSetupWizard
extends VolumeShortcutToggleAccessibilityServicePreferenceFragment {
private boolean mToggleSwitchWasInitiallyChecked;
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mToggleSwitchWasInitiallyChecked = mToggleServiceSwitchPreference.isChecked();
}
@Override
public int getMetricsCategory() {
return SettingsEnums.SUW_ACCESSIBILITY_TOGGLE_SCREEN_READER;
}
@Override
public void onStop() {
// Log the final choice in value if it's different from the previous value.
if (mToggleServiceSwitchPreference.isChecked() != mToggleSwitchWasInitiallyChecked) {
mMetricsFeatureProvider.action(getContext(),
SettingsEnums.SUW_ACCESSIBILITY_TOGGLE_SCREEN_READER,
mToggleServiceSwitchPreference.isChecked());
}
super.onStop();
}
}

View File

@@ -1,51 +0,0 @@
/*
* Copyright (C) 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.accessibility;
import android.app.settings.SettingsEnums;
import android.os.Bundle;
import android.view.View;
/** For accessibility services that target SDK <= Q in setup wizard. */
public class VolumeShortcutToggleSelectToSpeakPreferenceFragmentForSetupWizard
extends VolumeShortcutToggleAccessibilityServicePreferenceFragment {
private boolean mToggleSwitchWasInitiallyChecked;
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mToggleSwitchWasInitiallyChecked = mToggleServiceSwitchPreference.isChecked();
}
@Override
public int getMetricsCategory() {
return SettingsEnums.SUW_ACCESSIBILITY_TOGGLE_SCREEN_READER;
}
@Override
public void onStop() {
// Log the final choice in value if it's different from the previous value.
if (mToggleServiceSwitchPreference.isChecked() != mToggleSwitchWasInitiallyChecked) {
mMetricsFeatureProvider.action(getContext(),
SettingsEnums.SUW_ACCESSIBILITY_TOGGLE_SELECT_TO_SPEAK,
mToggleServiceSwitchPreference.isChecked());
}
super.onStop();
}
}