Clean-Room Replication of Mobile Apps: Process, Acceptance, and Boundaries Under Authorization

    This article explains how to replicate a mobile app only when you own it or have written authorization. It covers clean-room separation, six replication levels, a five-step workflow from scoping through same-device acceptance, and a compliance checklist that keeps the work inside legal and security limits.

    Clean-room replication applies to only two situations: rebuilding an app you developed and fully own, or working on a project for which the rights holder has given written authorization. Before you start, check whether the target app’s user agreement, open-source licenses, and third-party service terms allow this kind of use. Legality depends on the scope of authorization, the intended use, and the jurisdiction. This article is not legal advice. A formal project should be reviewed by counsel.

    Looking only at the interface and not at the code does not automatically make the work compliant. A clean-room process exists to separate roles, pass specifications, and keep evidence. It is not a way to bypass rights restrictions.

    1. What Clean-Room Replication Means

    Clean room is a process-isolation practice from software engineering. Its core requirements are:

    • Specification writers and implementers are separated. Implementers do not see the target app’s source code, decompiled output, or internal protocol documents.
    • The specification describes only observable behavior. It does not include internal implementation details.
    • Logs, screenshots, and version records are kept throughout so independent development can be explained later.

    Glancing at a screen and rewriting the app is not a clean-room process. The point is to reduce the risk of similar code and to leave evidence that can be reviewed.

    2. Replication Levels and Acceptance Criteria

    The replication goal should be verifiable. The table below divides depth into six levels:

    Level Depth Typical result Recommended as a goal?
    L0 Design reference only Static pages, no features Acceptable starting point
    L1 Layout recreation Matching page structure, no interaction Acceptable starting point
    L2 Basic interaction Buttons work and navigation is correct Suitable for prototype validation
    L3 Functional parity Real data flow and core features work Recommended acceptance target
    L4 Performance and feel Response time and motion close to the original Evaluate against project budget
    L5 Full equivalence Edge cases and error handling all match Not recommended; hard to verify and higher risk

    L3 should be broken into checkable items. For example: a core flow can be completed from start to finish; control count and hierarchy on each major screen match the specification; state changes after key actions match the specification list; and invalid input does not crash the app and produces a clear message.

    3. A Five-Step Workflow

    Step 1: Set the level and the scope

    Decide the target level and the feature boundary first. For an app that includes content generation and basic editing, you might cover only the core generation flow and two or three basic editing features, and mark everything else as out of scope. A clearer scope makes later acceptance easier.

    Step 2: Connect the test device

    On a test device you own, enable developer options and USB debugging, then connect it to the development host with a cable. On the host, run adb devices and confirm the device state is device. Then run adb shell pm list packages, find the package name of the app under test, and use that package name in later commands.

    This step is only for testing an app you own or are authorized to test. The test device should not store other people’s accounts, payment details, or personal data.

    Step 3: Capture the UI structure

    The platform’s built-in UI automation tool can export the interface structure. On the device, run uiautomator dump. The result is written to an XML file on the device; copy it to the host with adb pull. Each control in the XML has class, text, resource-id, and bounds attributes. bounds uses the form [left,top][right,bottom]. The control center is ((left+right)/2, (top+bottom)/2).

    Keep three points in mind while capturing:

    1. Record screen resolution and pixel density. Coordinates must be converted across devices.
    2. WebView or custom-drawn controls may not be read completely and should be marked separately.
    3. Dynamic content such as carousels and lists should be captured more than once, and only the intersection should be kept, so transient data is not written into the specification.

    Screenshots supplement visual parameters such as color, corner radius, and type size. Record those values in the specification, and use a color scheme you design yourself. Do not copy brand-specific colors.

    Step 4: Produce the specification lists

    The specification is the intermediate product between investigation and rebuild. Include at least two tables.

    Minimum fields for a screen-by-screen UI difference table:

    • Screen ID and screen name
    • Control ID, control type, and hierarchy path
    • Relative position and size, consistently in dp
    • Visual parameters such as color, type size, and corner radius
    • Notes on differences from the reference design

    Minimum fields for a behavior audit table:

    • Case ID and precondition
    • Steps, such as tap, swipe, or input
    • Expected result and actual result
    • State changes, such as navigation or data added or removed
    • Conclusion: pass, fail, or pending

    The people who capture the UI write these lists. Implementers work only from the lists. They do not receive the target app’s package, original screenshots, or capture scripts.

    Step 5: Rebuild natively and accept on the same device

    Rebuild with the target platform’s native language, such as Kotlin on Android. If a backend is required, a lightweight service can be built in Python, and it should implement only the interfaces listed in the specification.

    For acceptance, install the new app and the original app on the same device, run each case in the behavior audit table, and record the result. After every case passes, perform L3 acceptance. Archive the acceptance records and version numbers so the work can be traced later.

    4. Risk and Compliance Checklist

    Before implementation, confirm each item:

    1. Intellectual property: do not copy source code, assets, icons, font files, or trademarks. Original interface design may be protected by design rights or copyright, so assess how close the result is to the original design.
    2. Data compliance: do not collect, store, or forward real users’ personal information. Generate your own test data.
    3. Security boundary: do not bypass login, payment, captcha, or risk controls, and do not break authorization checks.
    4. Terms of service: confirm whether the target service’s terms prohibit automation. If they do, do not use automation tools.
    5. Evidence: keep capture logs, specification versions, development records, and acceptance reports for later review.

    5. Where This Method Fits

    This method is a reasonable fit for:

    • Product prototype validation: early in a project, confirming at lower cost whether a particular interaction or feature combination is viable
    • Technical teaching: helping learners understand mobile UI automation, testing, and how to write requirements
    • Authorized follow-on development: using the replica as a starting point for new features when authorization is explicit

    A project that will enter production still needs security testing, performance testing, and operational monitoring. Those are ordinary engineering practices and are outside the scope of this article.

    Frequently Asked Questions

    What authorization does replication require?
    You need written authorization from the rights holder, or you must own the app. Public availability for download does not mean the app may be replicated.

    Why does uiautomator dump miss some controls?
    Common reasons are that a control has no resource-id, the screen is drawn by WebView or Canvas, or the interface is still animating. Wait until the screen is stable and capture again, or mark the item as pending in the specification.

    What usually causes replication to fail?
    There are three main causes: the specification is too vague, so implementers have to guess; coordinates were not converted, so taps land in the wrong place on other resolutions; and login state and error branches were ignored, so the core flow cannot be completed in a real environment.