Improve the UI of Press & hold power button settings

The following changes has been made:
- The on/off toggle for Assistant now becomes two radio selectors ("Power Menu" and "Digital Assistant"). This is to make things clearer that Press & hold power button can be configured to power menu.
- The corresponding power menu animation will be shown when "Power Menu" is selected.
- The Assistant specific sensitivity settings and the foot notes are hidden when "Power Menu" is selected.
- Some minor wording updates according to the requests from Assistant / Settings UXW.

Bug: 229722937
Test: robotest, manual
Change-Id: Ib356fba861ad8c4a2626a0e0bd8cf3e4d90ce9a6
This commit is contained in:
Peter Zhang
2022-07-15 16:00:22 +02:00
parent 51d087cd67
commit f0013da134
20 changed files with 1213 additions and 572 deletions

View File

@@ -16,9 +16,6 @@
package com.android.settings.gestures;
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.settings.R;
@@ -32,25 +29,17 @@ public class PowerMenuPreferenceController extends BasePreferenceController {
@Override
public CharSequence getSummary() {
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) {
return mContext.getText(
R.string.power_menu_summary_long_press_for_assist_disabled_with_power_menu);
if (PowerMenuSettingsUtils.isLongPressPowerForAssistantEnabled(mContext)) {
return mContext.getText(R.string.power_menu_summary_long_press_for_assistant);
} else {
return mContext.getText(
R.string.power_menu_summary_long_press_for_assist_disabled_no_action);
return mContext.getText(R.string.power_menu_summary_long_press_for_power_menu);
}
}
@Override
public int getAvailabilityStatus() {
return isAssistInvocationAvailable() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
}
private boolean isAssistInvocationAvailable() {
return mContext.getResources().getBoolean(
com.android.internal.R.bool.config_longPressOnPowerForAssistantSettingAvailable);
return PowerMenuSettingsUtils.isLongPressPowerSettingAvailable(mContext)
? AVAILABLE
: UNSUPPORTED_ON_DEVICE;
}
}