Add gestures as inline actions for Phone Buddy

Add the following gestures as inline:
- Assist gesture
- Double tap power
- Double tap screen
- Pickup
- Swipe for notification

Bug:62022517
Test: make RunSettingsRoboTests
Change-Id: Ib246b97a0b924bf18f464d3548b7e4c393fc1931
This commit is contained in:
Matthew Fritze
2017-07-08 16:15:24 -07:00
parent 4b4ad6efc2
commit 469e4ea228
12 changed files with 334 additions and 16 deletions

View File

@@ -39,7 +39,6 @@ import org.robolectric.shadows.ShadowApplication;
import java.util.ArrayList;
import java.util.List;
import static android.provider.Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Mockito.doReturn;
@@ -107,7 +106,7 @@ public class DoubleTwistPreferenceControllerTest {
public void onPreferenceChange_hasWorkProfile_shouldUpdateSettingForWorkProfileUser() {
final int managedId = 2;
ShadowSecureSettings.putIntForUser(
null, CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 0, managedId);
null, Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 0, managedId);
DoubleTwistPreferenceController controller =
spy(new DoubleTwistPreferenceController(mContext, null, KEY_DOUBLE_TWIST));
doReturn(managedId).when(controller).getManagedProfileUserId();
@@ -115,12 +114,12 @@ public class DoubleTwistPreferenceControllerTest {
// enable the gesture
controller.onPreferenceChange(null, true);
assertThat(Settings.Secure.getIntForUser(mContext.getContentResolver(),
CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 0, managedId)).isEqualTo(1);
Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 0, managedId)).isEqualTo(1);
// disable the gesture
controller.onPreferenceChange(null, false);
assertThat(Settings.Secure.getIntForUser(mContext.getContentResolver(),
CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 1, managedId)).isEqualTo(0);
Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 1, managedId)).isEqualTo(0);
}
@Test
@@ -128,7 +127,7 @@ public class DoubleTwistPreferenceControllerTest {
// Set the setting to be enabled.
final Context context = ShadowApplication.getInstance().getApplicationContext();
Settings.System.putInt(context.getContentResolver(),
CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 1);
Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 1);
mController = new DoubleTwistPreferenceController(context, null, KEY_DOUBLE_TWIST);
assertThat(mController.isSwitchPrefEnabled()).isTrue();
@@ -139,7 +138,7 @@ public class DoubleTwistPreferenceControllerTest {
// Set the setting to be disabled.
final Context context = ShadowApplication.getInstance().getApplicationContext();
Settings.System.putInt(context.getContentResolver(),
CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 0);
Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, 0);
mController = new DoubleTwistPreferenceController(context, null, KEY_DOUBLE_TWIST);
assertThat(mController.isSwitchPrefEnabled()).isFalse();