Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e76dbfa1 authored by Amy Zhang's avatar Amy Zhang Committed by Android (Google) Code Review
Browse files

Merge "Remove Lnb updating related implementation from Tuner JNI/java"

parents 43459390 210c26a9
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -351,7 +351,6 @@ public class Tuner implements AutoCloseable {
        mUserId = ActivityManager.getCurrentUser();

        setFrontendInfoList();
        setLnbIds();
    }

    private void setFrontendInfoList() {
@@ -405,14 +404,6 @@ public class Tuner implements AutoCloseable {
        return nativeGetFrontendIds();
    }

    private void setLnbIds() {
        int[] ids = nativeGetLnbIds();
        if (ids == null) {
            return;
        }
        mTunerResourceManager.setLnbInfoList(ids);
    }

    /**
     * Sets the listener for resource lost.
     *
@@ -574,7 +565,6 @@ public class Tuner implements AutoCloseable {
    private native Filter nativeOpenFilter(int type, int subType, long bufferSize);
    private native TimeFilter nativeOpenTimeFilter();

    private native int[] nativeGetLnbIds();
    private native Lnb nativeOpenLnbByHandle(int handle);
    private native Lnb nativeOpenLnbByName(String name);

+0 −28
Original line number Diff line number Diff line
@@ -1473,28 +1473,6 @@ jobject JTuner::getFrontendInfo(int id) {
            maxSymbolRate, acquireRange, exclusiveGroupId, statusCaps, jcaps);
}

jintArray JTuner::getLnbIds() {
    ALOGD("JTuner::getLnbIds()");
    Result res;
    hidl_vec<LnbId> lnbIds;
    mTuner->getLnbIds([&](Result r, const hidl_vec<LnbId>& ids) {
        lnbIds = ids;
        res = r;
    });
    if (res != Result::SUCCESS || lnbIds.size() == 0) {
        ALOGW("Lnb isn't available");
        return NULL;
    }

    mLnbIds = lnbIds;
    JNIEnv *env = AndroidRuntime::getJNIEnv();

    jintArray ids = env->NewIntArray(mLnbIds.size());
    env->SetIntArrayRegion(ids, 0, mLnbIds.size(), reinterpret_cast<jint*>(&mLnbIds[0]));

    return ids;
}

jobject JTuner::openLnbById(int id) {
    sp<ILnb> iLnbSp;
    Result r;
@@ -3433,11 +3411,6 @@ static jobject android_media_tv_Tuner_get_frontend_info(JNIEnv *env, jobject thi
    return tuner->getFrontendInfo(id);
}

static jintArray android_media_tv_Tuner_get_lnb_ids(JNIEnv *env, jobject thiz) {
    sp<JTuner> tuner = getTuner(env, thiz);
    return tuner->getLnbIds();
}

static jobject android_media_tv_Tuner_open_lnb_by_handle(JNIEnv *env, jobject thiz, jint handle) {
    sp<JTuner> tuner = getTuner(env, thiz);
    uint32_t id = getResourceIdFromHandle(handle);
@@ -4484,7 +4457,6 @@ static const JNINativeMethod gTunerMethods[] = {
            (void *)android_media_tv_Tuner_open_filter },
    { "nativeOpenTimeFilter", "()Landroid/media/tv/tuner/filter/TimeFilter;",
            (void *)android_media_tv_Tuner_open_time_filter },
    { "nativeGetLnbIds", "()[I", (void *)android_media_tv_Tuner_get_lnb_ids },
    { "nativeOpenLnbByHandle", "(I)Landroid/media/tv/tuner/Lnb;",
            (void *)android_media_tv_Tuner_open_lnb_by_handle },
    { "nativeOpenLnbByName", "(Ljava/lang/String;)Landroid/media/tv/tuner/Lnb;",
+0 −2
Original line number Diff line number Diff line
@@ -217,7 +217,6 @@ struct JTuner : public RefBase {
    int stopScan();
    int setLnb(int id);
    int setLna(bool enable);
    jintArray getLnbIds();
    jobject openLnbById(int id);
    jobject openLnbByName(jstring name);
    jobject openFilter(DemuxFilterType type, int bufferSize);
@@ -247,7 +246,6 @@ private:
    sp<::android::hardware::tv::tuner::V1_1::IFrontend> mFe_1_1;
    sp<FrontendClient> mFeClient;
    int mFeId;
    hidl_vec<LnbId> mLnbIds;
    // TODO: remove after migrate to client lib
    sp<ILnb> mLnb;
    // TODO: remove after migrate to client lib
+4 −4
Original line number Diff line number Diff line
@@ -27,11 +27,11 @@ namespace android {

/////////////// FrontendClient ///////////////////////

FrontendClient::FrontendClient(shared_ptr<ITunerFrontend> tunerFrontend, int frontendHandle) {
FrontendClient::FrontendClient(shared_ptr<ITunerFrontend> tunerFrontend, int id) {
    mTunerFrontend = tunerFrontend;
    mAidlCallback = NULL;
    mHidlCallback = NULL;
    mFrontendHandle = frontendHandle;
    mId = id;
}

FrontendClient::~FrontendClient() {
@@ -40,7 +40,7 @@ FrontendClient::~FrontendClient() {
    mFrontend_1_1 = NULL;
    mAidlCallback = NULL;
    mHidlCallback = NULL;
    mFrontendHandle = -1;
    mId = -1;
}

Result FrontendClient::setCallback(sp<FrontendClientCallback> frontendClientCallback) {
@@ -123,7 +123,7 @@ shared_ptr<ITunerFrontend> FrontendClient::getAidlFrontend() {
}

int FrontendClient::getId() {
    return getResourceIdFromHandle(mFrontendHandle);
    return mId;
}

/////////////// TunerFrontendCallback ///////////////////////
+2 −6
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ private:
struct FrontendClient : public RefBase {

public:
    FrontendClient(shared_ptr<ITunerFrontend> tunerFrontend, int frontendHandle);
    FrontendClient(shared_ptr<ITunerFrontend> tunerFrontend, int id);
    ~FrontendClient();

    /**
@@ -135,10 +135,6 @@ public:

    int getId();

    static int getResourceIdFromHandle(int handle) {
        return (handle & 0x00ff0000) >> 16;
    }

private:
    /**
     * An AIDL Tuner Frontend Singleton assigned at the first time when the Tuner Client
@@ -163,7 +159,7 @@ private:
    shared_ptr<TunerFrontendCallback> mAidlCallback;
    sp<HidlFrontendCallback> mHidlCallback;

    int mFrontendHandle;
    int mId;
};
}  // namespace android

Loading