Revert "Revert "Add sensitivity configuration to long press power dialog""

This reverts commit c4084d4141.

Reason for revert: Dependant change has now successfully been propagated to sc-v2-dev child graphs

Change-Id: I1f6126a423c72540d219b99e20b464b51ef65923
This commit is contained in:
Govinda Wasserman
2021-08-20 17:06:40 +00:00
parent c4084d4141
commit 3869aac6d3
12 changed files with 569 additions and 62 deletions

View File

@@ -16,30 +16,23 @@
package com.android.settings.gestures;
import android.content.Context;
import android.provider.Settings;
import static com.android.settings.gestures.PowerMenuSettingsUtils.LONG_PRESS_POWER_ASSISTANT_VALUE;
import static com.android.settings.gestures.PowerMenuSettingsUtils.LONG_PRESS_POWER_GLOBAL_ACTIONS;
import android.content.Context;
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
public class PowerMenuPreferenceController extends BasePreferenceController {
private static final String POWER_BUTTON_LONG_PRESS_SETTING =
Settings.Global.POWER_BUTTON_LONG_PRESS;
@VisibleForTesting
static final int LONG_PRESS_POWER_GLOBAL_ACTIONS = 1;
@VisibleForTesting
static final int LONG_PRESS_POWER_ASSISTANT_VALUE = 5;
public PowerMenuPreferenceController(Context context, String key) {
super(context, key);
}
@Override
public CharSequence getSummary() {
final int powerButtonValue = getPowerButtonLongPressValue(mContext);
final int powerButtonValue = PowerMenuSettingsUtils.getPowerButtonSettingValue(mContext);
if (powerButtonValue == LONG_PRESS_POWER_ASSISTANT_VALUE) {
return mContext.getText(R.string.power_menu_summary_long_press_for_assist_enabled);
} else if (powerButtonValue == LONG_PRESS_POWER_GLOBAL_ACTIONS) {
@@ -60,11 +53,4 @@ public class PowerMenuPreferenceController extends BasePreferenceController {
return mContext.getResources().getBoolean(
com.android.internal.R.bool.config_longPressOnPowerForAssistantSettingAvailable);
}
private static int getPowerButtonLongPressValue(Context context) {
return Settings.Global.getInt(context.getContentResolver(),
POWER_BUTTON_LONG_PRESS_SETTING,
context.getResources().getInteger(
com.android.internal.R.integer.config_longPressOnPowerBehavior));
}
}