Merge "Moves Swipe Up overlay from Settings app to android.internal" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9a93a1dbe9
@@ -131,7 +131,4 @@
|
|||||||
<!-- List of a11y components on the device allowed to be enabled by Settings Slices -->
|
<!-- List of a11y components on the device allowed to be enabled by Settings Slices -->
|
||||||
<string-array name="config_settings_slices_accessibility_components" translatable="false"/>
|
<string-array name="config_settings_slices_accessibility_components" translatable="false"/>
|
||||||
|
|
||||||
<!-- Whether or not swipe up gesture's opt-in setting is available on this device -->
|
|
||||||
<bool name="config_swipe_up_gesture_setting_available">false</bool>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -24,7 +24,7 @@ import android.os.UserManager;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.support.annotation.VisibleForTesting;
|
import android.support.annotation.VisibleForTesting;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.internal.R;
|
||||||
|
|
||||||
public class SwipeUpPreferenceController extends GesturePreferenceController {
|
public class SwipeUpPreferenceController extends GesturePreferenceController {
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public class SwipeUpPreferenceController extends GesturePreferenceController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final ComponentName recentsComponentName = ComponentName.unflattenFromString(
|
final ComponentName recentsComponentName = ComponentName.unflattenFromString(
|
||||||
context.getString(com.android.internal.R.string.config_recentsComponentName));
|
context.getString(R.string.config_recentsComponentName));
|
||||||
final Intent quickStepIntent = new Intent(ACTION_QUICKSTEP)
|
final Intent quickStepIntent = new Intent(ACTION_QUICKSTEP)
|
||||||
.setPackage(recentsComponentName.getPackageName());
|
.setPackage(recentsComponentName.getPackageName());
|
||||||
if (context.getPackageManager().resolveService(quickStepIntent,
|
if (context.getPackageManager().resolveService(quickStepIntent,
|
||||||
@@ -81,7 +81,7 @@ public class SwipeUpPreferenceController extends GesturePreferenceController {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isChecked() {
|
public boolean isChecked() {
|
||||||
final int defaultValue = mContext.getResources()
|
final int defaultValue = mContext.getResources()
|
||||||
.getBoolean(com.android.internal.R.bool.config_swipe_up_gesture_default) ? ON : OFF;
|
.getBoolean(R.bool.config_swipe_up_gesture_default) ? ON : OFF;
|
||||||
final int swipeUpEnabled = Settings.Secure.getInt(mContext.getContentResolver(),
|
final int swipeUpEnabled = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
Settings.Secure.SWIPE_UP_TO_SWITCH_APPS_ENABLED, defaultValue);
|
Settings.Secure.SWIPE_UP_TO_SWITCH_APPS_ENABLED, defaultValue);
|
||||||
return swipeUpEnabled != OFF;
|
return swipeUpEnabled != OFF;
|
||||||
|
@@ -27,7 +27,7 @@ import android.content.pm.ResolveInfo;
|
|||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.internal.R;
|
||||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||||
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
||||||
|
|
||||||
@@ -57,8 +57,7 @@ public class SwipeUpPreferenceControllerTest {
|
|||||||
public void setUp() {
|
public void setUp() {
|
||||||
SettingsShadowResources.overrideResource(R.bool.config_swipe_up_gesture_setting_available,
|
SettingsShadowResources.overrideResource(R.bool.config_swipe_up_gesture_setting_available,
|
||||||
true);
|
true);
|
||||||
SettingsShadowResources.overrideResource(
|
SettingsShadowResources.overrideResource(R.bool.config_swipe_up_gesture_default, true);
|
||||||
com.android.internal.R.bool.config_swipe_up_gesture_default, true);
|
|
||||||
|
|
||||||
mContext = RuntimeEnvironment.application;
|
mContext = RuntimeEnvironment.application;
|
||||||
mPackageManager = Shadows.shadowOf(mContext.getPackageManager());
|
mPackageManager = Shadows.shadowOf(mContext.getPackageManager());
|
||||||
@@ -107,8 +106,7 @@ public class SwipeUpPreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIsChecked_defaultIsFalse_shouldReturnFalse() {
|
public void testIsChecked_defaultIsFalse_shouldReturnFalse() {
|
||||||
SettingsShadowResources.overrideResource(
|
SettingsShadowResources.overrideResource(R.bool.config_swipe_up_gesture_default, false);
|
||||||
com.android.internal.R.bool.config_swipe_up_gesture_default, false);
|
|
||||||
assertThat(mController.isChecked()).isFalse();
|
assertThat(mController.isChecked()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user