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

Commit 43953f34 authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk Committed by Android (Google) Code Review
Browse files

Merge "Switch to the new Java-based RadioService."

parents 45faa6a4 9b595f3f
Loading
Loading
Loading
Loading
+14 −33
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.hardware.radio;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.content.Context;
@@ -27,7 +26,6 @@ import android.os.Parcelable;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager.ServiceNotFoundException;
import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.Log;

@@ -1482,10 +1480,6 @@ public class RadioManager {
            return STATUS_BAD_VALUE;
        }

        if (mService == null) {
            return nativeListModules(modules);
        }

        Log.d(TAG, "Listing available tuners...");
        List<ModuleProperties> returnedList;
        try {
@@ -1526,7 +1520,6 @@ public class RadioManager {
            throw new IllegalArgumentException("callback must not be empty");
        }

        if (mService != null) {
        Log.d(TAG, "Opening tuner " + moduleId + "...");

        ITuner tuner;
@@ -1544,27 +1537,15 @@ public class RadioManager {
        return new TunerAdapter(tuner);
    }

        RadioModule module = new RadioModule(moduleId, config, withAudio, callback, handler);
        if (!module.initCheck()) {
            Log.e(TAG, "Failed to open tuner");
            module = null;
        }

        return (RadioTuner)module;
    }

    @NonNull private final Context mContext;
    // TODO(b/36863239): NonNull when transitioned from native service
    @Nullable private final IRadioService mService;
    @NonNull private final IRadioService mService;

    /**
     * @hide
     */
    public RadioManager(@NonNull Context context) throws ServiceNotFoundException {
        mContext = context;

        boolean isServiceJava = SystemProperties.getBoolean("config.enable_java_radio", false);
        mService = isServiceJava ? IRadioService.Stub.asInterface(
                ServiceManager.getServiceOrThrow(Context.RADIO_SERVICE)) : null;
        mService = IRadioService.Stub.asInterface(
                ServiceManager.getServiceOrThrow(Context.RADIO_SERVICE));
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -27,8 +27,7 @@ import android.util.Slog;
import java.util.List;

class Tuner extends ITuner.Stub {
    // TODO(b/36863239): rename to RadioService.Tuner when native service goes away
    private static final String TAG = "RadioServiceJava.Tuner";
    private static final String TAG = "RadioService.Tuner";

    /**
     * This field is used by native code, do not access or modify.
+1 −2
Original line number Diff line number Diff line
@@ -27,8 +27,7 @@ import android.os.RemoteException;
import android.util.Slog;

class TunerCallback implements ITunerCallback {
    // TODO(b/36863239): rename to RadioService.TunerCallback when native service goes away
    private static final String TAG = "RadioServiceJava.TunerCallback";
    private static final String TAG = "RadioService.TunerCallback";

    /**
     * This field is used by native code, do not access or modify.
+1 −4
Original line number Diff line number Diff line
@@ -703,8 +703,6 @@ public final class SystemServer {
        boolean disableVrManager = SystemProperties.getBoolean("config.disable_vrmanager", false);
        boolean disableCameraService = SystemProperties.getBoolean("config.disable_cameraservice",
                false);
        // TODO(b/36863239): Remove when transitioned from native service.
        boolean enableRadioService = SystemProperties.getBoolean("config.enable_java_radio", false);
        boolean enableLeftyService = SystemProperties.getBoolean("config.enable_lefty", false);

        boolean isEmulator = SystemProperties.get("ro.kernel.qemu").equals("1");
@@ -1206,8 +1204,7 @@ public final class SystemServer {
            mSystemServiceManager.startService(AudioService.Lifecycle.class);
            traceEnd();

            if (enableRadioService &&
                    mPackageManager.hasSystemFeature(PackageManager.FEATURE_RADIO)) {
            if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_RADIO)) {
                traceBeginAndSlog("StartRadioService");
                mSystemServiceManager.startService(RadioService.class);
                traceEnd();