Merge "[VolumePanel] Redirect volume panel action to SystemUI" into tm-qpr-dev

This commit is contained in:
Jenhou (Alan) Huang
2022-08-30 05:11:39 +00:00
committed by Android (Google) Code Review
2 changed files with 32 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.util.FeatureFlagUtils;
public class PanelFeatureProviderImpl implements PanelFeatureProvider {
@@ -49,9 +50,19 @@ public class PanelFeatureProviderImpl implements PanelFeatureProvider {
case Settings.Panel.ACTION_WIFI:
return WifiPanel.create(context);
case Settings.Panel.ACTION_VOLUME:
return VolumePanel.create(context);
if (FeatureFlagUtils.isEnabled(context,
FeatureFlagUtils.SETTINGS_VOLUME_PANEL_IN_SYSTEMUI)) {
// Redirect to the volume panel in SystemUI.
Intent volumeIntent = new Intent(Settings.Panel.ACTION_VOLUME);
volumeIntent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND).setPackage(
SYSTEMUI_PACKAGE_NAME);
context.sendBroadcast(volumeIntent);
return null;
} else {
return VolumePanel.create(context);
}
}
throw new IllegalStateException("No matching panel for: " + panelType);
throw new IllegalStateException("No matching panel for: " + panelType);
}
}