Integrate One handed mode shortcut preference
1) Update AccessibilityShortcutPreferenceFragment extends DashboardFragment 2) OneHandedSettings extends AccessibilityShortcutPreferenceFragment for shortcut feature 3) Add General Category above shortcut preference Test: Settings > System > Gesture > One handed mode Test: Settings > A11y > System Controls > One handed mode Test: make RunSettingsRoboTests ROBOTEST_FILTER= "com.android.settings .OneHandedShortcutPreferenceControllerTest" Test: make RunSettingsRoboTests ROBOTEST_FILTER= "com.android.settings .OneHandedShortcutPreferenceFragmentTest" Test: make RunSettingsRoboTests ROBOTEST_FILTER= "com.android.settings .OneHandedActionPullDownPrefControllerTest" Test: make RunSettingsRoboTests ROBOTEST_FILTER= "com.android.settings .OneHandedActionShowNotificationPreferenceControllerTest" Test: make RunSettingsRoboTests ROBOTEST_FILTER= "com.android.settings .OneHandedSettingsUtilsTest" Test: make RunSettingsRoboTests ROBOTEST_FILTER= "com.android.settings .AccessibilityShortcutPreferenceFragmentTest" Bug: 182425480 Change-Id: I653388beea422e9bf47fd3240367fb374d6f0025
This commit is contained in:
@@ -22,6 +22,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.ComponentName;
|
||||
@@ -30,6 +31,7 @@ import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
@@ -179,6 +181,7 @@ public class AccessibilityShortcutPreferenceFragmentTest {
|
||||
AccessibilityUtil.UserShortcutType.SOFTWARE
|
||||
| AccessibilityUtil.UserShortcutType.HARDWARE);
|
||||
mFragment.onCreate(savedInstanceState);
|
||||
mFragment.onAttach(mContext);
|
||||
mFragment.setupEditShortcutDialog(dialog);
|
||||
final int value = mFragment.getShortcutTypeCheckBoxValue();
|
||||
mFragment.saveNonEmptyUserShortcutType(value);
|
||||
@@ -191,6 +194,20 @@ public class AccessibilityShortcutPreferenceFragmentTest {
|
||||
| AccessibilityUtil.UserShortcutType.HARDWARE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void showGeneralCategory_shouldInitCategory() {
|
||||
final Bundle savedInstanceState = new Bundle();
|
||||
when(mFragment.showGeneralCategory()).thenReturn(true);
|
||||
mFragment.onCreate(savedInstanceState);
|
||||
|
||||
verify(mFragment).initGeneralCategory();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void showGeneralCategory_shouldSetDefaultDescription() {
|
||||
assertThat(mFragment.getGeneralCategoryDescription(null)).isNotNull();
|
||||
}
|
||||
|
||||
private void callEmptyOnClicked(DialogInterface dialog, int which) {}
|
||||
|
||||
private void putStringIntoSettings(String key, String componentName) {
|
||||
@@ -214,9 +231,35 @@ public class AccessibilityShortcutPreferenceFragmentTest {
|
||||
return PLACEHOLDER_PACKAGE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUserShortcutTypes() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CharSequence getGeneralCategoryDescription(@Nullable CharSequence title) {
|
||||
return super.getGeneralCategoryDescription(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean showGeneralCategory() {
|
||||
// For showGeneralCategory_shouldInitCategory()
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getLogTag() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user