mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 20:07:30 +09:00
Remove unused code for managing physical audio devices.
This was only used in B2G/Gonk and can go.
This commit is contained in:
parent
ea5ece2be9
commit
7f6182b5a3
7 changed files with 0 additions and 273 deletions
90
hal/Hal.cpp
90
hal/Hal.cpp
|
|
@ -754,96 +754,6 @@ UnlockScreenOrientation()
|
|||
PROXY_IF_SANDBOXED(UnlockScreenOrientation());
|
||||
}
|
||||
|
||||
void
|
||||
EnableSwitchNotifications(SwitchDevice aDevice) {
|
||||
AssertMainThread();
|
||||
PROXY_IF_SANDBOXED(EnableSwitchNotifications(aDevice));
|
||||
}
|
||||
|
||||
void
|
||||
DisableSwitchNotifications(SwitchDevice aDevice) {
|
||||
AssertMainThread();
|
||||
PROXY_IF_SANDBOXED(DisableSwitchNotifications(aDevice));
|
||||
}
|
||||
|
||||
SwitchState GetCurrentSwitchState(SwitchDevice aDevice)
|
||||
{
|
||||
AssertMainThread();
|
||||
RETURN_PROXY_IF_SANDBOXED(GetCurrentSwitchState(aDevice), SWITCH_STATE_UNKNOWN);
|
||||
}
|
||||
|
||||
void NotifySwitchStateFromInputDevice(SwitchDevice aDevice, SwitchState aState)
|
||||
{
|
||||
AssertMainThread();
|
||||
PROXY_IF_SANDBOXED(NotifySwitchStateFromInputDevice(aDevice, aState));
|
||||
}
|
||||
|
||||
typedef mozilla::ObserverList<SwitchEvent> SwitchObserverList;
|
||||
|
||||
static SwitchObserverList *sSwitchObserverLists = nullptr;
|
||||
|
||||
static SwitchObserverList&
|
||||
GetSwitchObserverList(SwitchDevice aDevice) {
|
||||
MOZ_ASSERT(0 <= aDevice && aDevice < NUM_SWITCH_DEVICE);
|
||||
if (sSwitchObserverLists == nullptr) {
|
||||
sSwitchObserverLists = new SwitchObserverList[NUM_SWITCH_DEVICE];
|
||||
}
|
||||
return sSwitchObserverLists[aDevice];
|
||||
}
|
||||
|
||||
static void
|
||||
ReleaseObserversIfNeeded() {
|
||||
for (int i = 0; i < NUM_SWITCH_DEVICE; i++) {
|
||||
if (sSwitchObserverLists[i].Length() != 0)
|
||||
return;
|
||||
}
|
||||
|
||||
//The length of every list is 0, no observer in the list.
|
||||
delete [] sSwitchObserverLists;
|
||||
sSwitchObserverLists = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
RegisterSwitchObserver(SwitchDevice aDevice, SwitchObserver *aObserver)
|
||||
{
|
||||
AssertMainThread();
|
||||
SwitchObserverList& observer = GetSwitchObserverList(aDevice);
|
||||
observer.AddObserver(aObserver);
|
||||
if (observer.Length() == 1) {
|
||||
EnableSwitchNotifications(aDevice);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
UnregisterSwitchObserver(SwitchDevice aDevice, SwitchObserver *aObserver)
|
||||
{
|
||||
AssertMainThread();
|
||||
|
||||
if (!sSwitchObserverLists) {
|
||||
return;
|
||||
}
|
||||
|
||||
SwitchObserverList& observer = GetSwitchObserverList(aDevice);
|
||||
if (!observer.RemoveObserver(aObserver) || observer.Length() > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
DisableSwitchNotifications(aDevice);
|
||||
ReleaseObserversIfNeeded();
|
||||
}
|
||||
|
||||
void
|
||||
NotifySwitchChange(const SwitchEvent& aEvent)
|
||||
{
|
||||
// When callback this notification, main thread may call unregister function
|
||||
// first. We should check if this pointer is valid.
|
||||
if (!sSwitchObserverLists)
|
||||
return;
|
||||
|
||||
SwitchObserverList& observer = GetSwitchObserverList(aEvent.device());
|
||||
observer.Broadcast(aEvent);
|
||||
}
|
||||
|
||||
static AlarmObserver* sAlarmObserver;
|
||||
|
||||
bool
|
||||
|
|
|
|||
31
hal/Hal.h
31
hal/Hal.h
|
|
@ -401,37 +401,6 @@ MOZ_MUST_USE bool LockScreenOrientation(const dom::ScreenOrientationInternal& aO
|
|||
*/
|
||||
void UnlockScreenOrientation();
|
||||
|
||||
/**
|
||||
* Register an observer for the switch of given SwitchDevice.
|
||||
*
|
||||
* The observer will receive data whenever the data generated by the
|
||||
* given switch.
|
||||
*/
|
||||
void RegisterSwitchObserver(hal::SwitchDevice aDevice, hal::SwitchObserver *aSwitchObserver);
|
||||
|
||||
/**
|
||||
* Unregister an observer for the switch of given SwitchDevice.
|
||||
*/
|
||||
void UnregisterSwitchObserver(hal::SwitchDevice aDevice, hal::SwitchObserver *aSwitchObserver);
|
||||
|
||||
/**
|
||||
* Notify the state of the switch.
|
||||
*
|
||||
* This API is internal to hal; clients shouldn't call it directly.
|
||||
*/
|
||||
void NotifySwitchChange(const hal::SwitchEvent& aEvent);
|
||||
|
||||
/**
|
||||
* Get current switch information.
|
||||
*/
|
||||
hal::SwitchState GetCurrentSwitchState(hal::SwitchDevice aDevice);
|
||||
|
||||
/**
|
||||
* Notify switch status change from input device.
|
||||
*/
|
||||
void NotifySwitchStateFromInputDevice(hal::SwitchDevice aDevice,
|
||||
hal::SwitchState aState);
|
||||
|
||||
/**
|
||||
* Register an observer that is notified when a programmed alarm
|
||||
* expires.
|
||||
|
|
|
|||
|
|
@ -54,16 +54,6 @@ void EnableScreenConfigurationNotifications();
|
|||
*/
|
||||
void DisableScreenConfigurationNotifications();
|
||||
|
||||
/**
|
||||
* Enable switch notifications from the backend
|
||||
*/
|
||||
void EnableSwitchNotifications(hal::SwitchDevice aDevice);
|
||||
|
||||
/**
|
||||
* Disable switch notifications from the backend
|
||||
*/
|
||||
void DisableSwitchNotifications(hal::SwitchDevice aDevice);
|
||||
|
||||
/**
|
||||
* Enable alarm notifications from the backend.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -33,26 +33,6 @@ enum ShutdownMode {
|
|||
eHalShutdownMode_Count = 3
|
||||
};
|
||||
|
||||
class SwitchEvent;
|
||||
|
||||
enum SwitchDevice {
|
||||
SWITCH_DEVICE_UNKNOWN = -1,
|
||||
SWITCH_HEADPHONES,
|
||||
SWITCH_USB,
|
||||
NUM_SWITCH_DEVICE
|
||||
};
|
||||
|
||||
enum SwitchState {
|
||||
SWITCH_STATE_UNKNOWN = -1,
|
||||
SWITCH_STATE_ON,
|
||||
SWITCH_STATE_OFF,
|
||||
SWITCH_STATE_HEADSET, // Headphone with microphone
|
||||
SWITCH_STATE_HEADPHONE, // without microphone
|
||||
NUM_SWITCH_STATE
|
||||
};
|
||||
|
||||
typedef Observer<SwitchEvent> SwitchObserver;
|
||||
|
||||
// Note that we rely on the order of this enum's entries. Higher priorities
|
||||
// should have larger int values.
|
||||
enum ProcessPriority {
|
||||
|
|
@ -141,28 +121,6 @@ struct ParamTraits<mozilla::hal::WakeLockControl>
|
|||
mozilla::hal::NUM_WAKE_LOCK>
|
||||
{};
|
||||
|
||||
/**
|
||||
* Serializer for SwitchState
|
||||
*/
|
||||
template <>
|
||||
struct ParamTraits<mozilla::hal::SwitchState>:
|
||||
public ContiguousEnumSerializer<
|
||||
mozilla::hal::SwitchState,
|
||||
mozilla::hal::SWITCH_STATE_UNKNOWN,
|
||||
mozilla::hal::NUM_SWITCH_STATE> {
|
||||
};
|
||||
|
||||
/**
|
||||
* Serializer for SwitchDevice
|
||||
*/
|
||||
template <>
|
||||
struct ParamTraits<mozilla::hal::SwitchDevice>:
|
||||
public ContiguousEnumSerializer<
|
||||
mozilla::hal::SwitchDevice,
|
||||
mozilla::hal::SWITCH_DEVICE_UNKNOWN,
|
||||
mozilla::hal::NUM_SWITCH_DEVICE> {
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::hal::ProcessPriority>:
|
||||
public ContiguousEnumSerializer<
|
||||
|
|
|
|||
|
|
@ -10,26 +10,6 @@ using namespace mozilla::hal;
|
|||
namespace mozilla {
|
||||
namespace hal_impl {
|
||||
|
||||
void
|
||||
EnableSwitchNotifications(SwitchDevice aDevice)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
DisableSwitchNotifications(SwitchDevice aDevice)
|
||||
{
|
||||
}
|
||||
|
||||
SwitchState
|
||||
GetCurrentSwitchState(SwitchDevice aDevice) {
|
||||
return SWITCH_STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
void
|
||||
NotifySwitchStateFromInputDevice(SwitchDevice aDevice, SwitchState aState)
|
||||
{
|
||||
}
|
||||
|
||||
bool IsHeadphoneEventFromInputDev()
|
||||
{
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@ using mozilla::dom::ScreenOrientationInternal from "mozilla/dom/ScreenOrientatio
|
|||
using mozilla::hal::SensorType from "mozilla/HalSensor.h";
|
||||
using mozilla::hal::SensorAccuracyType from "mozilla/HalSensor.h";
|
||||
using mozilla::hal::WakeLockControl from "mozilla/HalTypes.h";
|
||||
using mozilla::hal::SwitchState from "mozilla/HalTypes.h";
|
||||
using mozilla::hal::SwitchDevice from "mozilla/HalTypes.h";
|
||||
using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h";
|
||||
using nsIntRect from "nsRect.h";
|
||||
using PRTime from "prtime.h";
|
||||
|
|
@ -41,11 +39,6 @@ struct NetworkInformation {
|
|||
uint32_t dhcpGateway;
|
||||
};
|
||||
|
||||
struct SwitchEvent {
|
||||
SwitchDevice device;
|
||||
SwitchState status;
|
||||
};
|
||||
|
||||
struct WakeLockInformation {
|
||||
nsString topic;
|
||||
uint32_t numLocks;
|
||||
|
|
@ -80,7 +73,6 @@ child:
|
|||
async NotifyNetworkChange(NetworkInformation aNetworkInfo);
|
||||
async NotifyWakeLockChange(WakeLockInformation aWakeLockInfo);
|
||||
async NotifyScreenConfigurationChange(ScreenConfiguration aScreenOrientation);
|
||||
async NotifySwitchChange(SwitchEvent aEvent);
|
||||
async NotifySystemClockChange(int64_t aClockDeltaMS);
|
||||
async NotifySystemTimezoneChange(SystemTimezoneChangeInformation aSystemTimezoneChangeInfo);
|
||||
|
||||
|
|
@ -138,11 +130,6 @@ parent:
|
|||
returns (bool allowed);
|
||||
async UnlockScreenOrientation();
|
||||
|
||||
async EnableSwitchNotifications(SwitchDevice aDevice);
|
||||
async DisableSwitchNotifications(SwitchDevice aDevice);
|
||||
sync GetCurrentSwitchState(SwitchDevice aDevice)
|
||||
returns (SwitchState aState);
|
||||
|
||||
async FactoryReset(nsString aReason);
|
||||
|
||||
child:
|
||||
|
|
|
|||
|
|
@ -300,34 +300,6 @@ GetWakeLockInfo(const nsAString &aTopic, WakeLockInformation *aWakeLockInfo)
|
|||
Hal()->SendGetWakeLockInfo(nsString(aTopic), aWakeLockInfo);
|
||||
}
|
||||
|
||||
void
|
||||
EnableSwitchNotifications(SwitchDevice aDevice)
|
||||
{
|
||||
Hal()->SendEnableSwitchNotifications(aDevice);
|
||||
}
|
||||
|
||||
void
|
||||
DisableSwitchNotifications(SwitchDevice aDevice)
|
||||
{
|
||||
Hal()->SendDisableSwitchNotifications(aDevice);
|
||||
}
|
||||
|
||||
SwitchState
|
||||
GetCurrentSwitchState(SwitchDevice aDevice)
|
||||
{
|
||||
SwitchState state;
|
||||
Hal()->SendGetCurrentSwitchState(aDevice, &state);
|
||||
return state;
|
||||
}
|
||||
|
||||
void
|
||||
NotifySwitchStateFromInputDevice(SwitchDevice aDevice, SwitchState aState)
|
||||
{
|
||||
Unused << aDevice;
|
||||
Unused << aState;
|
||||
NS_RUNTIMEABORT("Only the main process may notify switch state change.");
|
||||
}
|
||||
|
||||
bool
|
||||
EnableAlarm()
|
||||
{
|
||||
|
|
@ -420,7 +392,6 @@ class HalParent : public PHalParent
|
|||
, public ISensorObserver
|
||||
, public WakeLockObserver
|
||||
, public ScreenConfigurationObserver
|
||||
, public SwitchObserver
|
||||
, public SystemClockChangeObserver
|
||||
, public SystemTimezoneChangeObserver
|
||||
{
|
||||
|
|
@ -440,10 +411,6 @@ public:
|
|||
hal::UnregisterWakeLockObserver(this);
|
||||
hal::UnregisterSystemClockChangeObserver(this);
|
||||
hal::UnregisterSystemTimezoneChangeObserver(this);
|
||||
for (int32_t switchDevice = SWITCH_DEVICE_UNKNOWN + 1;
|
||||
switchDevice < NUM_SWITCH_DEVICE; ++switchDevice) {
|
||||
hal::UnregisterSwitchObserver(SwitchDevice(switchDevice), this);
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool
|
||||
|
|
@ -771,34 +738,6 @@ public:
|
|||
Unused << SendNotifyWakeLockChange(aWakeLockInfo);
|
||||
}
|
||||
|
||||
virtual bool
|
||||
RecvEnableSwitchNotifications(const SwitchDevice& aDevice) override
|
||||
{
|
||||
// Content has no reason to listen to switch events currently.
|
||||
hal::RegisterSwitchObserver(aDevice, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool
|
||||
RecvDisableSwitchNotifications(const SwitchDevice& aDevice) override
|
||||
{
|
||||
hal::UnregisterSwitchObserver(aDevice, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Notify(const SwitchEvent& aSwitchEvent) override
|
||||
{
|
||||
Unused << SendNotifySwitchChange(aSwitchEvent);
|
||||
}
|
||||
|
||||
virtual bool
|
||||
RecvGetCurrentSwitchState(const SwitchDevice& aDevice, hal::SwitchState *aState) override
|
||||
{
|
||||
// Content has no reason to listen to switch events currently.
|
||||
*aState = hal::GetCurrentSwitchState(aDevice);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Notify(const int64_t& aClockDeltaMS) override
|
||||
{
|
||||
Unused << SendNotifySystemClockChange(aClockDeltaMS);
|
||||
|
|
@ -868,12 +807,6 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
virtual bool
|
||||
RecvNotifySwitchChange(const mozilla::hal::SwitchEvent& aEvent) override {
|
||||
hal::NotifySwitchChange(aEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool
|
||||
RecvNotifySystemClockChange(const int64_t& aClockDeltaMS) override {
|
||||
hal::NotifySystemClockChange(aClockDeltaMS);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue