Add gestures as inline actions for Phone Buddy am: 469e4ea228

am: c44f8c8256

Change-Id: Ic3d11679a7b87c429b3cdb8eeba3c5d208cd5866
This commit is contained in:
Matthew Fritze
2017-07-17 17:48:59 +00:00
committed by android-build-merger
12 changed files with 334 additions and 16 deletions

View File

@@ -38,7 +38,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;
@@ -101,7 +100,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();
@@ -109,12 +108,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
@@ -122,7 +121,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();
@@ -133,7 +132,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();