Merge "Add predictive back aconfig flag" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
e615b8fca4
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.android.settings.development;
|
package com.android.settings.development;
|
||||||
|
|
||||||
|
import static com.android.window.flags.Flags.predictiveBackSystemAnimations;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
@@ -55,6 +57,11 @@ public class BackAnimationPreferenceController extends DeveloperOptionsPreferenc
|
|||||||
mFragment = fragment;
|
mFragment = fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAvailable() {
|
||||||
|
return !predictiveBackSystemAnimations();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPreferenceKey() {
|
public String getPreferenceKey() {
|
||||||
return BACK_NAVIGATION_ANIMATION_KEY;
|
return BACK_NAVIGATION_ANIMATION_KEY;
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ import android.net.Uri;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
|
import android.platform.test.annotations.RequiresFlagsDisabled;
|
||||||
|
import android.platform.test.annotations.RequiresFlagsEnabled;
|
||||||
|
import android.platform.test.flag.junit.CheckFlagsRule;
|
||||||
|
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
@@ -37,8 +41,11 @@ import androidx.preference.SwitchPreference;
|
|||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
import androidx.test.platform.app.InstrumentationRegistry;
|
import androidx.test.platform.app.InstrumentationRegistry;
|
||||||
|
|
||||||
|
import com.android.window.flags.Flags;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.MockitoAnnotations;
|
import org.mockito.MockitoAnnotations;
|
||||||
@@ -58,6 +65,9 @@ public class BackAnimationPreferenceControllerTest {
|
|||||||
private BackAnimationPreferenceController mController;
|
private BackAnimationPreferenceController mController;
|
||||||
private Looper mLooper;
|
private Looper mLooper;
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
@@ -80,6 +90,18 @@ public class BackAnimationPreferenceControllerTest {
|
|||||||
mController.displayPreference(screen);
|
mController.displayPreference(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@RequiresFlagsEnabled(Flags.FLAG_PREDICTIVE_BACK_SYSTEM_ANIMATIONS)
|
||||||
|
public void controllerNotAvailable_whenAconfigFlagEnabled() {
|
||||||
|
assertFalse(mController.isAvailable());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@RequiresFlagsDisabled(Flags.FLAG_PREDICTIVE_BACK_SYSTEM_ANIMATIONS)
|
||||||
|
public void controllerAvailable_whenAconfigFlagDisabled() {
|
||||||
|
assertTrue(mController.isAvailable());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onPreferenceChange_switchEnabled_shouldEnableBackAnimations() {
|
public void onPreferenceChange_switchEnabled_shouldEnableBackAnimations() {
|
||||||
mController.onPreferenceChange(mPreference, true /* new value */);
|
mController.onPreferenceChange(mPreference, true /* new value */);
|
||||||
|
|||||||
Reference in New Issue
Block a user