[Galaxy Note 4 Original Android Development] dl12345:
UPDATE ON MUTED IN-CALL AUDIO AFTER BOOTING

After some experimentation I have been able to consistently replicate the issue where there is no audio (both incoming and outgoing audio) on outgoing calls after booting. This problem will resolve itself spontaneously if you receive an incoming call.

Unfortunately I have not yet been able to find the root cause behind this but I do, fortunately, have a temporary workaround for you until such time as I can track down the problem.

As background, I noticed that if I had keypad sounds enabled under Settings-->Sound-->Other sounds that I had no problem on call audio for outgoing calls. After playing around with it some more, I realized that it was actually the generation of the DTMF tone when pressing a button on the dialpad that was enabling the call audio. The solution to the problem is to hack the Dialer app and force it to generate a very short DTMF tone on startup, on the order of 1 millisecond. This enables call audio on outgoing calls.

For those of you who are interested, the precise change to the code in DialerApplication.java is as follows

public class DialerApplication extends Application {

private static final String TAG = "DialerApplication";

private static Context sContext;

private ToneGenerator mToneGenerator;
private final Object mToneGeneratorLock = new Object();

@Override
public void onCreate() {
sContext = this;
Trace.beginSection(TAG + " onCreate");
super.onCreate();
Trace.beginSection(TAG + " ExtensionsFactory initialization");

/* Muted call audio hack begin */

synchronized (mToneGeneratorLock) {
if (mToneGenerator == null) {
try {
mToneGenerator = new ToneGenerator(AudioManager.STREAM_DTMF, 80);
mToneGenerator.startTone(ToneGenerator.TONE_DTMF_1, 1);
} catch (RuntimeException e) {
mToneGenerator = null;
}
}
}
synchronized (mToneGeneratorLock) {
if (mToneGenerator != null) {
mToneGenerator.release();
mToneGenerator = null;
}
}

/* Muted call audio hack end */

ExtensionsFactory.init(getApplicationContext());
Trace.endSection();
new BlockedNumbersAutoMigrator(PreferenceManager.getDefaultSharedPreferences(this),
new FilteredNumberAsyncQueryHandler(getContentResolver())).autoMigrate();
Trace.endSection();
}

@Nullable
public static Context getContext() {
return sContext;
}

@NeededForTesting
public static void setContextForTest(Context context) {
sContext = context;
}
}

When the dialer app starts up you will hear a very brief "click" sound. This is the code above emitting a DTMF tone which then enables the call audio.

You can find a link to the download for this hacked Dialer app in the first post at the top of this thread. Download and flash it using TWRP. Then wipe cache and dalvik. The zip will replace the stock dialer with the hacked one and delete the OpenGapps Google Dialer if you have it installed [NOTE: if you have Google Dialer installed anywhere other than /system/priv-app/GoogleDialer then you will need to remove it manually]

This hack will be included in future releases until such time as I locate and fix the underlying reason for this behaviour. Please be aware that if you install any other dialer you will have the same problem again.