Redirect Volume Panel to settings page
Flag: com.android.settings.flags.slices_retirement Bug: 328529042 Bug: 202262476 Test: manual test adb shell am start -a android.settings.panel.action.VOLUME Change-Id: I54f30d18eb10db864dcf5ee745b168b03e388b14
This commit is contained in:
@@ -22,11 +22,15 @@ import android.os.Bundle;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.FeatureFlagUtils;
|
import android.util.FeatureFlagUtils;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
|
import com.android.settings.flags.Flags;
|
||||||
|
|
||||||
public class PanelFeatureProviderImpl implements PanelFeatureProvider {
|
public class PanelFeatureProviderImpl implements PanelFeatureProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public PanelContent getPanel(Context context, Bundle bundle) {
|
public PanelContent getPanel(Context context, Bundle bundle) {
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
return null;
|
return null;
|
||||||
@@ -59,7 +63,14 @@ public class PanelFeatureProviderImpl implements PanelFeatureProvider {
|
|||||||
context.sendBroadcast(volumeIntent);
|
context.sendBroadcast(volumeIntent);
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return VolumePanel.create(context);
|
if (Flags.slicesRetirement()) {
|
||||||
|
Intent volIntent = new Intent(Settings.ACTION_SOUND_SETTINGS);
|
||||||
|
volIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
context.startActivity(volIntent);
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return VolumePanel.create(context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,12 +27,15 @@ import static org.mockito.Mockito.verify;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.platform.test.annotations.DisableFlags;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.FeatureFlagUtils;
|
import android.util.FeatureFlagUtils;
|
||||||
|
|
||||||
import androidx.test.core.app.ApplicationProvider;
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
|
import com.android.settings.flags.Flags;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -68,6 +71,7 @@ public class PanelFeatureProviderImplTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@DisableFlags(Flags.FLAG_SLICES_RETIREMENT)
|
||||||
public void getPanel_volumePanel_returnsCorrectPanel() {
|
public void getPanel_volumePanel_returnsCorrectPanel() {
|
||||||
FeatureFlagUtils.setEnabled(mContext, FeatureFlagUtils.SETTINGS_VOLUME_PANEL_IN_SYSTEMUI,
|
FeatureFlagUtils.setEnabled(mContext, FeatureFlagUtils.SETTINGS_VOLUME_PANEL_IN_SYSTEMUI,
|
||||||
false);
|
false);
|
||||||
|
|||||||
Reference in New Issue
Block a user