Allow Magnification Settings launch from outside of AccessibilitySettings
Before this CL, Magnification Settings can only be
launched from MagnificationPreferenceController.
This CL initializes FooterPreferenceController if the
parent class does not initialize it from Intent extras.
Bug: 268411305
Test: manual
make RunSettingsRoboTests ROBOTEST_FILTER=MagnificationGesturesPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=ToggleScreenMagnificationPreferenceFragmentTest
Change-Id: I954739c39c823ce7fe0daa711743f729d182571b
This commit is contained in:
@@ -29,6 +29,7 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.icu.text.CaseMap;
|
||||
import android.icu.text.MessageFormat;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.DeviceConfig;
|
||||
@@ -220,6 +221,34 @@ public class ToggleScreenMagnificationPreferenceFragment extends
|
||||
addJoystickSetting(generalCategory);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onProcessArguments(Bundle arguments) {
|
||||
Context context = getContext();
|
||||
|
||||
// This Fragment may get arguments from MagnificationGesturesPreferenceController or
|
||||
// MagnificationNavbarPreferenceController and it's necessary to check if a key exists
|
||||
// before putting a new value into arguments.
|
||||
|
||||
if (!arguments.containsKey(AccessibilitySettings.EXTRA_PREFERENCE_KEY)) {
|
||||
arguments.putString(AccessibilitySettings.EXTRA_PREFERENCE_KEY,
|
||||
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED);
|
||||
}
|
||||
|
||||
if (!arguments.containsKey(AccessibilitySettings.EXTRA_INTRO)) {
|
||||
arguments.putCharSequence(AccessibilitySettings.EXTRA_INTRO,
|
||||
context.getString(R.string.accessibility_screen_magnification_intro_text));
|
||||
}
|
||||
|
||||
if (!arguments.containsKey(AccessibilitySettings.EXTRA_HTML_DESCRIPTION)) {
|
||||
String summary = MessageFormat.format(
|
||||
context.getString(R.string.accessibility_screen_magnification_summary),
|
||||
new Object[]{1, 2, 3, 4, 5});
|
||||
arguments.putCharSequence(AccessibilitySettings.EXTRA_HTML_DESCRIPTION, summary);
|
||||
}
|
||||
|
||||
super.onProcessArguments(arguments);
|
||||
}
|
||||
|
||||
private void addAlwaysOnSetting(PreferenceCategory generalCategory) {
|
||||
if (!DeviceConfig.getBoolean(
|
||||
DeviceConfig.NAMESPACE_WINDOW_MANAGER,
|
||||
|
||||
Reference in New Issue
Block a user