Magisk Setup & Guidance

Job ID: 40113421

Budget: $30 – $250 USD

Below is a **clean, copy-paste-ready freelancer task** specifically for **Magisk (no ROM build)**, written so an Android low-level engineer knows **exactly** what to do and what *not* to do.

---

## Freelancer Task: Magisk Module for SIP ⇄ SIM Audio Bridge (Jack-Only)

### Project Type

Android system / audio engineering (Magisk, AudioPolicy, rooted devices)

### Target Devices

* **Xiaomi Redmi 4A** (primary)
* **Xiaomi Redmi 6A** (secondary if available)
* Android **7.x** (4A) / Android **8–9** (6A)
* **Rooted with Magisk**
* **NO custom ROM building**

---

## Objective

Create a **Magisk module** that **forces all SIP and SIM call audio through the 3.5 mm wired headset jack only**, enabling **physical TRRS loopback audio bridging**, with **DSP fully disabled**.

## Technical Requirements

### Audio Routing (Critical)

* Force **wired headset / wired headphone** as the **only valid**:

* Audio **output** device
* Audio **input** device
* Disable or deprioritize:

* Speaker
* Earpiece
* Bluetooth SCO / A2DP
* USB audio (if it steals routing)

**Files to override (systemless via Magisk):**

* `/vendor/etc/audio_policy_configuration.xml`

* OR `/vendor/etc/audio_policy.conf` (older builds)

---

### DSP / Audio Effects (Critical)

Disable **all voice processing** that interferes with loopback audio:

* Acoustic Echo Cancellation (AEC)
* Noise Suppression (NS)
* Automatic Gain Control (AGC)

**Files to override (systemless):**

* `/vendor/etc/audio_effects.conf` or `.xml`
* `/system/etc/audio_effects.conf` (if referenced)

DSP must be **completely off** for:

* `STREAM_VOICE_CALL`
* `MODE_IN_CALL`
* `VOICE_COMMUNICATION`

---

### Magisk Module Structure

Deliver a standard Magisk module with:

```
SIP_SIM_JackOnly/
├─ module.prop
├─ post-fs-data.sh
├─ service.sh
└─ system/
├─ vendor/
│ └─ etc/
│ ├─ audio_policy_configuration.xml (or .conf)
│ └─ audio_effects.conf / .xml
└─ etc/
└─ audio_effects.conf (if needed)
```

---

### Boot-Time Enforcement (Required)

In `service.sh`:

* Disable Bluetooth audio routing (SCO/A2DP)
* Ensure wired headset is preferred at boot
* Optional but preferred:

* Restart `audioserver` once after boot
* Watchdog to re-enforce routing if audio stack restarts

---

### SIP App Compatibility

* SIP apps must be able to use:

* `STREAM_MUSIC` for playback
* Do **not** rely on SIP apps using `VOICE_COMMUNICATION`

---

## Validation & Testing (Mandatory)

The freelancer must provide:

* `dumpsys audio` output **before vs after**
* Proof that:

* Calls **never route to speaker**
* Wired headset remains active throughout calls
* DSP does not suppress injected loopback audio
* Test with:

* One SIP app (e.g., Linphone or similar)
* One SIM call

---

## Deliverables

1. **Flashable Magisk module** (zip or folder)
2. All modified config files with comments
3. Short README:

* Install steps
* Test procedure
* Known limitations
4. Confirmation:



---

## Skillset Required

* Android audio policy & routing
* Magisk systemless modules
* Rooted device debugging
* `dumpsys audio`, `logcat`, `audioserver`
* Xiaomi / Qualcomm audio stack familiarity

---

## Timeline

* 3–days for first working version
*

---

## Clarifying Notes for Freelancer

* Physical **TRRS loopback cable is already designed**
* Your job is **software enforcement only**
* This is a **telecom bridge**, not a consumer phone
* Stability > elegance

---

## Success Criteria (Simple)

> During SIP ⇄ SIM calls, **audio only flows through the wired headset jack**, with **no DSP**, **no speaker**, and **no ROM build**.

---