Add init() to avoid crash when creating ref in constructor.
This reverts commit 50899fb2696d2bb98a4807a237e124f566293f57.
Bug: 195717690
Fix: 195717690
Test: atest VtsHalTvTunerTargetTest
Change-Id: Icae435f1166e6cf2e2f235979e3d1d37d182d517
diff --git a/tv/tuner/aidl/default/Frontend.h b/tv/tuner/aidl/default/Frontend.h
index a98cc92..3c602cf 100644
--- a/tv/tuner/aidl/default/Frontend.h
+++ b/tv/tuner/aidl/default/Frontend.h
@@ -33,7 +33,7 @@
class Frontend : public BnFrontend {
public:
- Frontend(FrontendType type, int32_t id, Tuner* tuner);
+ Frontend(FrontendType type, int32_t id, std::shared_ptr<Tuner> tuner);
::ndk::ScopedAStatus setCallback(
const std::shared_ptr<IFrontendCallback>& in_callback) override;
@@ -59,7 +59,7 @@
virtual ~Frontend();
bool supportsSatellite();
std::shared_ptr<IFrontendCallback> mCallback;
- Tuner* mTuner;
+ std::shared_ptr<Tuner> mTuner;
FrontendType mType = FrontendType::UNDEFINED;
int32_t mId = 0;
bool mIsLocked = false;