Merge "Enable(visible) or Disabled(invisible) all one-handed settings preference by System Property flag configuration."

This commit is contained in:
Jason Chang
2020-05-13 08:01:13 +00:00
committed by Android (Google) Code Review
4 changed files with 54 additions and 3 deletions

View File

@@ -17,6 +17,7 @@
package com.android.settings.gestures;
import android.content.Context;
import android.os.SystemProperties;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
@@ -27,13 +28,17 @@ import com.android.settings.core.TogglePreferenceController;
**/
public class OneHandedEnablePreferenceController extends TogglePreferenceController {
static final String SUPPORT_ONE_HANDED_MODE = "ro.support_one_handed_mode";
public OneHandedEnablePreferenceController(Context context, String key) {
super(context, key);
}
@Override
public int getAvailabilityStatus() {
return BasePreferenceController.AVAILABLE;
return SystemProperties.getBoolean(SUPPORT_ONE_HANDED_MODE, false)
? BasePreferenceController.AVAILABLE
: BasePreferenceController.UNSUPPORTED_ON_DEVICE;
}
@Override

View File

@@ -17,6 +17,8 @@
package com.android.settings.gestures;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.os.SystemProperties;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
@@ -47,5 +49,11 @@ public class OneHandedSettings extends DashboardFragment {
}
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.one_handed_settings);
new BaseSearchIndexProvider(R.xml.one_handed_settings) {
@Override
protected boolean isPageSearchEnabled(Context context) {
return SystemProperties.getBoolean(
OneHandedEnablePreferenceController.SUPPORT_ONE_HANDED_MODE, false);
}
};
}