[VolumePanel] Redirect volume panel action to SystemUI

The volume panel is moved to SystemUIDialog, so we
redirect the volume
panel creation to SystemUI.

Bug: 202262476
Test: manual build and use adb to launch with the volume panel action
intent. $adb shell am start -a android.settings.panel.action.VOLUME

Change-Id: I9f23eb68fb7c83d6f0f023f5eefc4290a35db3c3
This commit is contained in:
Alan Huang
2022-05-02 04:40:13 +00:00
parent b75858bf82
commit a0da5b36bc
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);
}
}