Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28c3ba23 authored by Anurag Gupta's avatar Anurag Gupta Committed by Alin Jerpelea
Browse files

FM Radio: Add support for FM Radio in Android



Creating interface and framework for using FM Radio
RX and TX from different vendors.

Signed-off-by: default avatarChristian Bejram <christian.bejram@stericsson.com>
Change-Id: Change-Id: I1a71aed01bfffdddfabf1cdfbfa3707cb1ed016b

Conflicts:
	Android.mk
	core/java/android/app/ContextImpl.java

Conflicts:
	services/java/com/android/server/SystemServer.java
parent df51464d
Loading
Loading
Loading
Loading
+16 −2
Original line number Original line Diff line number Diff line
@@ -202,7 +202,21 @@ LOCAL_SRC_FILES += \
	telephony/java/com/android/internal/telephony/IExtendedNetworkService.aidl \
	telephony/java/com/android/internal/telephony/IExtendedNetworkService.aidl \
	voip/java/android/net/sip/ISipSession.aidl \
	voip/java/android/net/sip/ISipSession.aidl \
	voip/java/android/net/sip/ISipSessionListener.aidl \
	voip/java/android/net/sip/ISipSessionListener.aidl \
	voip/java/android/net/sip/ISipService.aidl
	voip/java/android/net/sip/ISipService.aidl \
	fmradio/java/com/stericsson/hardware/fm/IFmReceiver.aidl \
	fmradio/java/com/stericsson/hardware/fm/IFmTransmitter.aidl \
	fmradio/java/com/stericsson/hardware/fm/IOnStateChangedListener.aidl \
	fmradio/java/com/stericsson/hardware/fm/IOnStartedListener.aidl \
	fmradio/java/com/stericsson/hardware/fm/IOnErrorListener.aidl \
	fmradio/java/com/stericsson/hardware/fm/IOnScanListener.aidl \
	fmradio/java/com/stericsson/hardware/fm/IOnForcedPauseListener.aidl \
	fmradio/java/com/stericsson/hardware/fm/IOnForcedResetListener.aidl \
	fmradio/java/com/stericsson/hardware/fm/IOnBlockScanListener.aidl \
	fmradio/java/com/stericsson/hardware/fm/IOnRDSDataFoundListener.aidl \
	fmradio/java/com/stericsson/hardware/fm/IOnSignalStrengthListener.aidl \
	fmradio/java/com/stericsson/hardware/fm/IOnStereoListener.aidl \
	fmradio/java/com/stericsson/hardware/fm/IOnExtraCommandListener.aidl \
	fmradio/java/com/stericsson/hardware/fm/IOnAutomaticSwitchListener.aidl
#
#




@@ -528,7 +542,7 @@ include $(CLEAR_VARS)


LOCAL_SRC_FILES:=$(framework_docs_LOCAL_API_CHECK_SRC_FILES)
LOCAL_SRC_FILES:=$(framework_docs_LOCAL_API_CHECK_SRC_FILES)
LOCAL_INTERMEDIATE_SOURCES:=$(framework_docs_LOCAL_INTERMEDIATE_SOURCES)
LOCAL_INTERMEDIATE_SOURCES:=$(framework_docs_LOCAL_INTERMEDIATE_SOURCES)
LOCAL_JAVA_LIBRARIES:=$(framework_docs_LOCAL_JAVA_LIBRARIES)
LOCAL_JAVA_LIBRARIES:=$(framework_docs_LOCAL_JAVA_LIBRARIES) framework
LOCAL_MODULE_CLASS:=$(framework_docs_LOCAL_MODULE_CLASS)
LOCAL_MODULE_CLASS:=$(framework_docs_LOCAL_MODULE_CLASS)
LOCAL_DROIDDOC_SOURCE_PATH:=$(framework_docs_LOCAL_DROIDDOC_SOURCE_PATH)
LOCAL_DROIDDOC_SOURCE_PATH:=$(framework_docs_LOCAL_DROIDDOC_SOURCE_PATH)
LOCAL_DROIDDOC_HTML_DIR:=$(framework_docs_LOCAL_DROIDDOC_HTML_DIR)
LOCAL_DROIDDOC_HTML_DIR:=$(framework_docs_LOCAL_DROIDDOC_HTML_DIR)
+21 −0
Original line number Original line Diff line number Diff line
@@ -107,6 +107,13 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashMap;


import com.stericsson.hardware.fm.IFmReceiver;
import com.stericsson.hardware.fm.IFmTransmitter;
import com.stericsson.hardware.fm.FmReceiver;
import com.stericsson.hardware.fm.FmTransmitter;
import com.stericsson.hardware.fm.FmReceiverImpl;
import com.stericsson.hardware.fm.FmTransmitterImpl;

class ReceiverRestrictedContext extends ContextWrapper {
class ReceiverRestrictedContext extends ContextWrapper {
    ReceiverRestrictedContext(Context base) {
    ReceiverRestrictedContext(Context base) {
        super(base);
        super(base);
@@ -470,6 +477,20 @@ class ContextImpl extends Context {
                    final Context outerContext = ctx.getOuterContext();
                    final Context outerContext = ctx.getOuterContext();
                    return new ProfileManager (outerContext, ctx.mMainThread.getHandler());
                    return new ProfileManager (outerContext, ctx.mMainThread.getHandler());
                }});
                }});

        registerService("fm_receiver", new ServiceFetcher() {
                public Object createService(ContextImpl ctx) {
                    IBinder b = ServiceManager.getService("fm_receiver");
                    IFmReceiver service = IFmReceiver.Stub.asInterface(b);
                    return new FmReceiverImpl(service);
                }});

        registerService("fm_transmitter", new ServiceFetcher() {
                public Object createService(ContextImpl ctx) {
                    IBinder b = ServiceManager.getService("fm_transmitter");
                    IFmTransmitter service = IFmTransmitter.Stub.asInterface(b);
                    return new FmTransmitterImpl(service);
                }});
    }
    }


    static ContextImpl getImpl(Context context) {
    static ContextImpl getImpl(Context context) {
+16 −0
Original line number Original line Diff line number Diff line
@@ -805,6 +805,22 @@ public abstract class PackageManager {
    @SdkConstant(SdkConstantType.FEATURE)
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
    public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";


    /**
     * Feature for {@link #getSystemAvailableFeatures} and
     * {@link #hasSystemFeature}: The device is able to receive FM radio.
     * @hide
     */
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_RADIO_FM_RECEIVER = "com.stericsson.hardware.fm.receiver";

    /**
     * Feature for {@link #getSystemAvailableFeatures} and
     * {@link #hasSystemFeature}: The device is able to transmit FM radio.
     * @hide
     */
    @SdkConstant(SdkConstantType.FEATURE)
    public static final String FEATURE_RADIO_FM_TRANSMITTER = "com.stericsson.hardware.fm.transmitter";

    /**
    /**
     * Feature for {@link #getSystemAvailableFeatures} and
     * Feature for {@link #getSystemAvailableFeatures} and
     * {@link #hasSystemFeature}: The device supports one or more methods of
     * {@link #hasSystemFeature}: The device supports one or more methods of
+16 −0
Original line number Original line Diff line number Diff line
@@ -557,6 +557,22 @@
        android:label="@string/permlab_vibrate"
        android:label="@string/permlab_vibrate"
        android:description="@string/permdesc_vibrate" />
        android:description="@string/permdesc_vibrate" />


    <!-- Allows access to the FM Radio receiver
        @hide Pending API council approval -->
    <permission android:name="com.stericsson.permission.FM_RADIO_RECEIVER"
        android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
        android:protectionLevel="normal"
        android:label="@string/permlab_fm_radio_receiver"
        android:description="@string/permdesc_fm_radio_receiver" />

    <!-- Allows access to the FM Radio transmitter
         @hide Pending API council approval -->
    <permission android:name="com.stericsson.permission.FM_RADIO_TRANSMITTER"
        android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
        android:protectionLevel="dangerous"
        android:label="@string/permlab_fm_radio_transmitter"
        android:description="@string/permdesc_fm_radio_transmitter" />

    <!-- Allows access to the flashlight -->
    <!-- Allows access to the flashlight -->
    <permission android:name="android.permission.FLASHLIGHT"
    <permission android:name="android.permission.FLASHLIGHT"
        android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
        android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
+12 −0
Original line number Original line Diff line number Diff line
@@ -1179,6 +1179,18 @@
    <string name="permdesc_vibrate">Allows the application to control
    <string name="permdesc_vibrate">Allows the application to control
        the vibrator.</string>
        the vibrator.</string>


    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permlab_fm_radio_receiver">control FM receiver</string>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permdesc_fm_radio_receiver">Allows the application to control
        the FM receiver.</string>

    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permlab_fm_radio_transmitter">control FM transmitter</string>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permdesc_fm_radio_transmitter">Allows the application to control
        the FM transmitter.</string>

    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permlab_flashlight">control flashlight</string>
    <string name="permlab_flashlight">control flashlight</string>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
Loading