Create a setting for Assist invocation via long press power button
Adds a setting which allows the user to enable invoking the Assist app via long pressing the power button. The availability of setting is controlled by config_longPressOnPowerForAssistantSettingAvailable configuration value. Bug: 179175321 Bug: 182983853 Test: make RunSettingsRoboTests Change-Id: I2eb23e5b7539b2fb8e5bc85d23ca5795a08366c5
This commit is contained in:
@@ -57,7 +57,8 @@ public class PowerMenuPreferenceController extends BasePreferenceController {
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return isCardsAvailable() || isControlsAvailable() ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||
return isCardsAvailable() || isControlsAvailable() || isAssistInvocationAvailable()
|
||||
? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||
}
|
||||
|
||||
private boolean isControlsAvailable() {
|
||||
@@ -68,4 +69,9 @@ public class PowerMenuPreferenceController extends BasePreferenceController {
|
||||
return Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
CARDS_AVAILABLE_SETTING, 0) == 1;
|
||||
}
|
||||
|
||||
private boolean isAssistInvocationAvailable() {
|
||||
return mContext.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_longPressOnPowerForAssistantSettingAvailable);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user