Carrson C. Fung

29 papers A 3B 3C 1Misc 3Journal 11Unranked 8
YearRankTypeTitle / Venue / Authors
2024 J jnl
IEEE Open J. Commun. Soc.
Tang Chao, Carrson C. Fung, Zi-En Ni, Mykola Servetnyk
2023 J jnl
IEEE Trans. Big Data
Mykola Servetnyk, Carrson C. Fung
2022 J jnl
Phys. Commun.
Carrson C. Fung, Shao-Heng Tai
2022 J jnl
J. Commun. Networks
Mykola Servetnyk, Carrson C. Fung
2022 conf
APWCS
Aamer Mohamed Huroon, Yu-Chih Huang, Carrson C. Fung, Li-Chun Wang
2020 conf
EUSIPCO
Hong-Ming Chiu, Carrson C. Fung, Antonio Ortega
2020 J jnl
IEEE Wirel. Commun. Lett.
Mykola Servetnyk, Carrson C. Fung
2020 B conf
GLOBECOM
Mykola Servetnyk, Carrson C. Fung, Zhu Han
2019 Misc conf
ICASSP
Mykola Servetnyk, Carrson C. Fung
2018 Misc conf
ICASSP
Chun-Nien Chan, Carrson C. Fung
2017 B conf
PIMRC
Carrson C. Fung, Shao-Heng Tai
2015 J jnl
IEEE Trans. Commun.
Chieh-Yao Chang, Carrson C. Fung
2015 J jnl
IEEE Trans. Commun.
Chieh-Yao Chang, Carrson C. Fung
2013 J jnl
IEICE Trans. Commun.
Chin-Te Chiang, Carrson C. Fung
2012 conf
SSP
Chieh-Yao Chang, Carrson C. Fung
2011 conf
EUSIPCO
Ching-Hui Chen, Carrson C. Fung
2011 J jnl
IEEE Trans. Veh. Technol.
Chin-Te Chiang, Carrson C. Fung
2010 conf
ICC
Chin-Te Chiang, Carrson C. Fung
2009 conf
EUSIPCO
Yin-Ray Huang, Carrson C. Fung, Kainam Thomas Wong
2009 J jnl
IEEE Signal Process. Lett.
Yin-Ray Huang, Carrson C. Fung, Kainam Thomas Wong
2009 Misc conf
ICASSP
Ching-Hui Chen, Carrson C. Fung, Sheng-Jyh Wang
2008 conf
EUSIPCO
Fei Ji, Carrson C. Fung, Sam Kwong, Chi-Wah Kok
2007 J jnl
IEEE Trans. Signal Process.
Fangjiong Chen, Carrson C. Fung, Chi-Wah Kok, Sam Kwong
2006 C conf
ISCAS
Carrson C. Fung, Man-Wai Kwan, Chi-Wah Kok
2004 conf
EUSIPCO
Carrson C. Fung, Chi-Wah Kok
2003 B conf
PIMRC
Carrson C. Fung, Chi-Wah Kok
2000 A conf
INTERSPEECH
Chi H. Yim, Oscar C. Au, Wanggen Wan, Cyan L. Keung, Carrson C. Fung
2000 A conf
INTERSPEECH
Carrson C. Fung, Oscar C. Au, Wanggen Wan, Chi H. Yim, Cyan L. Keung
2000 A conf
INTERSPEECH
Cyan L. Keung, Oscar C. Au, Chi H. Yim, Carrson C. Fung
redb/extractors/decompiler/apk/library_filter.py
← Index redb/extractors/decompiler/apk/library_filter.py python
"""Package-based library filtering for APK DEX code analysis.

Determines whether a method belongs to a known library/framework package
and should be filtered out of content tables. This is the Android equivalent
of is_lib_or_thunk() in the Binary Ninja pipeline.
"""

import os
from typing import Dict, List


DEFAULT_LIBRARY_PREFIXES = [
    "android.",
    "androidx.",
    "com.google.android.",
    "com.google.firebase.",
    "com.google.gson.",
    "com.google.protobuf.",
    "kotlin.",
    "kotlinx.",
    "org.apache.",
    "com.squareup.",
    "io.reactivex.",
    "org.reactivestreams.",
    "com.facebook.",
    "com.crashlytics.",
    "io.fabric.",
    "org.junit.",
    "org.mockito.",
]


class LibraryFilter:
    """Filters library/framework classes from APK analysis."""

    def __init__(self, prefixes: List[str] = None):
        env_prefixes = os.getenv("APK_LIBRARY_PREFIXES")
        if env_prefixes:
            self._prefixes = [p.strip() for p in env_prefixes.split(",") if p.strip()]
        elif prefixes is not None:
            self._prefixes = prefixes
        else:
            self._prefixes = DEFAULT_LIBRARY_PREFIXES

        # Convert Dalvik-style prefixes to both formats for matching
        self._dot_prefixes = tuple(self._prefixes)

        self._stats = {"library": 0, "user": 0}

    def is_library(self, class_name: str) -> bool:
        """Check if a class belongs to a known library/framework package.

        Accepts both Java dot notation (com.example.Foo) and Dalvik
        descriptor notation (Lcom/example/Foo;).
        """
        # Normalize Dalvik descriptor to dot notation
        normalized = self._normalize_class_name(class_name)

        is_lib = normalized.startswith(self._dot_prefixes)
        if is_lib:
            self._stats["library"] += 1
        else:
            self._stats["user"] += 1
        return is_lib

    def get_filter_stats(self) -> Dict[str, int]:
        """Return counts of filtered vs. retained classes."""
        return dict(self._stats)

    @staticmethod
    def _normalize_class_name(class_name: str) -> str:
        """Convert Dalvik descriptor to dot notation.

        Lcom/example/Foo; -> com.example.Foo
        com.example.Foo -> com.example.Foo
        """
        if class_name.startswith("L") and class_name.endswith(";"):
            return class_name[1:-1].replace("/", ".")
        return class_name.replace("/", ".")