(2/n) Stop user from enabling OHM setting if user is using 3-button
mode
Return One-Handed mode getAvailabilityStatus to UNSUPPORTED_ON_DEVICE
when SystemNavigationMode is 3-button.
Bug: 184903678
Test: manual
Test: manual verified on Settings > System > Gesture page
Test: make RunSettingsRoboTests ROBOTEST_FILTER=
"com.android.settings.gestures
.OneHandedEnablePreferenceControllerTest"
Test: make RunSettingsRoboTests ROBOTEST_FILTER=
"com.android.settings.gestures
.SwipeBottomToNotificationPreferenceControllerTest"
Change-Id: I454dabb5cc267d544732fa5079f3146154d0568c
This commit is contained in:
@@ -176,6 +176,28 @@ public class OneHandedSettingsUtils {
|
||||
sCurrentUserId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get NavigationBar mode flag from Settings provider.
|
||||
* @param context App context
|
||||
* @return Navigation bar mode:
|
||||
* 0 = 3 button
|
||||
* 1 = 2 button
|
||||
* 2 = fully gestural
|
||||
*/
|
||||
public static int getNavigationBarMode(Context context) {
|
||||
return Settings.Secure.getIntForUser(context.getContentResolver(),
|
||||
Settings.Secure.NAVIGATION_MODE, 2 /* fully gestural */, sCurrentUserId);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param context App context
|
||||
* @return Support One-Handed mode feature or not.
|
||||
*/
|
||||
public static boolean isFeatureAvailable(Context context) {
|
||||
return isSupportOneHandedMode() && getNavigationBarMode(context) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers callback for observing Settings.Secure.ONE_HANDED_MODE_ENABLED state.
|
||||
* @param callback for state changes
|
||||
|
||||
Reference in New Issue
Block a user