QcRilAm: An app to handle QcRilAudio callbacks
This app simply communicates with the vendor.qti.hardware.radio.am hal and sets the callbacks required for functional incall audio. The interface definition of the hal was taken from: https://github.com/phhusson/treble_experimentations/tree/master/interfaces/vendor/qti/hardware/radio/am/1.0
This commit is contained in:
commit
d0e1cf6a93
8
Android.bp
Executable file
8
Android.bp
Executable file
|
@ -0,0 +1,8 @@
|
|||
subdirs = [
|
||||
"interface",
|
||||
]
|
||||
|
||||
hidl_package_root {
|
||||
name: "vendor.qti.hardware.radio.am",
|
||||
path: "vendor/sony/oss/qcrilam/interface/am",
|
||||
}
|
16
Android.mk
Normal file
16
Android.mk
Normal file
|
@ -0,0 +1,16 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_PACKAGE_NAME := QcRilAm
|
||||
LOCAL_CERTIFICATE := platform
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_PROPRIETARY_MODULE := true
|
||||
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, src)
|
||||
|
||||
LOCAL_JAVA_LIBRARIES := android.hidl.manager-V1.0-java
|
||||
LOCAL_STATIC_JAVA_LIBRARIES := vendor.qti.hardware.radio.am-V1.0-java
|
||||
|
||||
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
|
||||
|
||||
include $(BUILD_PACKAGE)
|
22
AndroidManifest.xml
Executable file
22
AndroidManifest.xml
Executable file
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
coreApp="true"
|
||||
package="com.sony.qcrilam"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="26" android:targetSdkVersion="26"/>
|
||||
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
|
||||
<application android:persistent="true" android:directBootAware="true" >
|
||||
<service android:name=".QcRilAmService" />
|
||||
<receiver android:name=".BootReceiver" android:enabled="true" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
</manifest>
|
15
interface/am/1.0/Android.bp
Normal file
15
interface/am/1.0/Android.bp
Normal file
|
@ -0,0 +1,15 @@
|
|||
// This file is autogenerated by hidl-gen -Landroidbp.
|
||||
|
||||
hidl_interface {
|
||||
name: "vendor.qti.hardware.radio.am@1.0",
|
||||
root: "vendor.qti.hardware.radio.am",
|
||||
srcs: [
|
||||
"IQcRilAudio.hal",
|
||||
"IQcRilAudioCallback.hal",
|
||||
],
|
||||
interfaces: [
|
||||
"android.hidl.base@1.0",
|
||||
],
|
||||
gen_java: true,
|
||||
}
|
||||
|
8
interface/am/1.0/IQcRilAudio.hal
Normal file
8
interface/am/1.0/IQcRilAudio.hal
Normal file
|
@ -0,0 +1,8 @@
|
|||
package vendor.qti.hardware.radio.am@1.0;
|
||||
|
||||
import vendor.qti.hardware.radio.am@1.0::IQcRilAudioCallback;
|
||||
|
||||
interface IQcRilAudio {
|
||||
oneway setCallback(IQcRilAudioCallback iQcRilAudioCallback);
|
||||
oneway setError(int32_t error);
|
||||
};
|
6
interface/am/1.0/IQcRilAudioCallback.hal
Normal file
6
interface/am/1.0/IQcRilAudioCallback.hal
Normal file
|
@ -0,0 +1,6 @@
|
|||
package vendor.qti.hardware.radio.am@1.0;
|
||||
|
||||
interface IQcRilAudioCallback {
|
||||
getParameters(string str) generates (string result);
|
||||
setParameters(string str) generates (int32_t success);
|
||||
};
|
7
proguard.flags
Normal file
7
proguard.flags
Normal file
|
@ -0,0 +1,7 @@
|
|||
-keep class com.sony.qcrilam.BootReceiver {
|
||||
*;
|
||||
}
|
||||
|
||||
-keep class com.sony.qcrilam.QcrRilAmService {
|
||||
*;
|
||||
}
|
24
src/com/sony/qcrilam/BootReceiver.java
Normal file
24
src/com/sony/qcrilam/BootReceiver.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
package com.sony.qcrilam;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
public class BootReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "QcRilAm-BootReceiver";
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (context == null || intent == null) {
|
||||
Log.w(TAG, "BOOT_COMPLETE NULL intent");
|
||||
return;
|
||||
}
|
||||
if (QcRilAmService.isServiceRunning()) {
|
||||
Log.d(TAG, "Service is already running");
|
||||
} else {
|
||||
intent.setClass(context, QcRilAmService.class);
|
||||
context.startService(new Intent(context, QcRilAmService.class));
|
||||
}
|
||||
}
|
||||
}
|
56
src/com/sony/qcrilam/QcRilAmService.java
Normal file
56
src/com/sony/qcrilam/QcRilAmService.java
Normal file
|
@ -0,0 +1,56 @@
|
|||
package com.sony.qcrilam;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.media.AudioSystem;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
import vendor.qti.hardware.radio.am.V1_0.IQcRilAudio;
|
||||
import vendor.qti.hardware.radio.am.V1_0.IQcRilAudioCallback;
|
||||
|
||||
public class QcRilAmService extends Service {
|
||||
private static final String TAG = "QcRilAm-Service";
|
||||
private static boolean isRunning = false;
|
||||
|
||||
public static boolean isServiceRunning() {
|
||||
return isRunning;
|
||||
}
|
||||
|
||||
private void addCallbackForSimSlot(int simSlotNo) {
|
||||
try {
|
||||
IQcRilAudio QcRilAudio = IQcRilAudio.getService("slot" + simSlotNo);
|
||||
if (QcRilAudio == null) {
|
||||
Log.e(TAG, "Could not get service instance for slot" + simSlotNo + ", failing");
|
||||
} else {
|
||||
QcRilAudio.setCallback(new IQcRilAudioCallback.Stub() {
|
||||
public String getParameters(String keys) {
|
||||
return AudioSystem.getParameters(keys);
|
||||
}
|
||||
|
||||
public int setParameters(String keyValuePairs) {
|
||||
return AudioSystem.setParameters(keyValuePairs);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch(RemoteException exception) {
|
||||
Log.e(TAG, "RemoteException while trying to add callback for slot" + simSlotNo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
isRunning = true;
|
||||
int simCount = TelephonyManager.from(this).getSimCount();
|
||||
for (int simSlotNo = 1; simSlotNo <= simCount; simSlotNo++) {
|
||||
addCallbackForSimSlot(simSlotNo);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue