Implement emergency radio in default HAL
Implemented adb shell command in default broadcast radio HAL to
simulate an emergency alert.
Bug: 361348719
Flag: EXEMPT HAL interface change
Test: adb root
Test: adb shell dumpsys android.hardware.broadcastradio.IBroadcastRadio/amfm --simulateAlert actual alert geo,transport future severe possible "alertmessage" en-US geocode:SAME,006109_geocode:SAME,006209_polygon:-38.47,-120.14,38.34,-119.95,38.52,-119.74,38.62,-119.89,-38.47,-120.14+geocode:SAME,006009
Change-Id: Idbfdb47a65c88bc3dc1839729b772bb285c563b4
diff --git a/broadcastradio/aidl/default/BroadcastRadio.h b/broadcastradio/aidl/default/BroadcastRadio.h
index 60ea907..a4cba3b 100644
--- a/broadcastradio/aidl/default/BroadcastRadio.h
+++ b/broadcastradio/aidl/default/BroadcastRadio.h
@@ -78,7 +78,8 @@
std::unique_ptr<::android::WorkerThread>(new ::android::WorkerThread());
bool mIsTuneCompleted GUARDED_BY(mMutex) = true;
Properties mProperties GUARDED_BY(mMutex);
- ProgramSelector mCurrentProgram GUARDED_BY(mMutex) = {};
+ ProgramSelector mCurrentProgramSelector GUARDED_BY(mMutex) = {};
+ ProgramInfo mCurrentProgramInfo GUARDED_BY(mMutex) = {};
std::vector<VirtualProgram> mProgramList GUARDED_BY(mMutex) = {};
std::optional<AmFmBandRange> mCurrentAmFmBandRange GUARDED_BY(mMutex);
std::shared_ptr<ITunerCallback> mCallback GUARDED_BY(mMutex);
@@ -99,6 +100,7 @@
void jumpToFirstSubChannelLocked(std::vector<VirtualProgram>::const_iterator& it) const
REQUIRES(mMutex);
bool isConfigFlagSetLocked(ConfigFlag flag) const REQUIRES(mMutex);
+ void updateCurrentProgramInfoWithAlert(std::optional<Alert>& alert);
binder_status_t cmdHelp(int fd) const;
binder_status_t cmdTune(int fd, const char** args, uint32_t numArgs);
@@ -107,6 +109,7 @@
binder_status_t cmdCancel(int fd, uint32_t numArgs);
binder_status_t cmdStartProgramListUpdates(int fd, const char** args, uint32_t numArgs);
binder_status_t cmdStopProgramListUpdates(int fd, uint32_t numArgs);
+ binder_status_t cmdSimulateAlert(int fd, const char** args, uint32_t numArgs);
binder_status_t dumpsys(int fd) EXCLUDES(mMutex);
};