Loading core/java/android/hardware/radio/IRadioService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -24,5 +24,5 @@ import android.hardware.radio.ITuner; * {@hide} */ interface IRadioService { ITuner openTuner(); ITuner openTuner(boolean withAudio); } core/java/android/hardware/radio/ITuner.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -20,5 +20,7 @@ import android.hardware.radio.RadioManager; /** {@hide} */ interface ITuner { void close(); int getProgramInformation(out RadioManager.ProgramInfo[] infoOut); } core/java/android/hardware/radio/RadioManager.java +5 −1 Original line number Diff line number Diff line Loading @@ -1448,10 +1448,14 @@ public class RadioManager { if (mService != null) { ITuner tuner; try { tuner = mService.openTuner(); tuner = mService.openTuner(withAudio); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } if (tuner == null) { Log.e(TAG, "Failed to open tuner"); return null; } return new TunerAdapter(tuner); } Loading core/java/android/hardware/radio/TunerAdapter.java +13 −2 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ class TunerAdapter extends RadioTuner { private static final String TAG = "radio.TunerAdapter"; @NonNull private final ITuner mTuner; private boolean mIsClosed = false; TunerAdapter(ITuner tuner) { if (tuner == null) { Loading @@ -41,8 +42,18 @@ class TunerAdapter extends RadioTuner { @Override public void close() { // TODO(b/36863239): forward to mTuner Log.w(TAG, "Close call not implemented"); synchronized (mTuner) { if (mIsClosed) { Log.d(TAG, "Tuner is already closed"); return; } mIsClosed = true; } try { mTuner.close(); } catch (RemoteException e) { Log.e(TAG, "Exception trying to close tuner", e); } } @Override Loading services/core/java/com/android/server/radio/RadioService.java +21 −13 Original line number Diff line number Diff line Loading @@ -28,29 +28,37 @@ public class RadioService extends SystemService { // TODO(b/36863239): rename to RadioService when native service goes away private static final String TAG = "RadioServiceJava"; private final RadioServiceImpl mServiceImpl = new RadioServiceImpl(); /** * This field is used by native code, do not access or modify. */ private final long mNativeContext = nativeInit(); public RadioService(Context context) { super(context); } @Override public void onStart() { publishBinderService(Context.RADIO_SERVICE, new RadioServiceImpl()); Slog.v(TAG, "RadioService started"); protected void finalize() throws Throwable { nativeFinalize(mNativeContext); super.finalize(); } private static class RadioServiceImpl extends IRadioService.Stub { private native long nativeInit(); private native void nativeFinalize(long nativeContext); private native Tuner openTunerNative(long nativeContext, boolean withAudio); @Override public ITuner openTuner() { Slog.d(TAG, "openTuner()"); return new TunerImpl(); } public void onStart() { publishBinderService(Context.RADIO_SERVICE, mServiceImpl); Slog.v(TAG, "RadioService started"); } private static class TunerImpl extends ITuner.Stub { private class RadioServiceImpl extends IRadioService.Stub { @Override public int getProgramInformation(RadioManager.ProgramInfo[] infoOut) { Slog.d(TAG, "getProgramInformation()"); return RadioManager.STATUS_INVALID_OPERATION; public ITuner openTuner(boolean withAudio) { return openTunerNative(mNativeContext, withAudio); } } } Loading
core/java/android/hardware/radio/IRadioService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -24,5 +24,5 @@ import android.hardware.radio.ITuner; * {@hide} */ interface IRadioService { ITuner openTuner(); ITuner openTuner(boolean withAudio); }
core/java/android/hardware/radio/ITuner.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -20,5 +20,7 @@ import android.hardware.radio.RadioManager; /** {@hide} */ interface ITuner { void close(); int getProgramInformation(out RadioManager.ProgramInfo[] infoOut); }
core/java/android/hardware/radio/RadioManager.java +5 −1 Original line number Diff line number Diff line Loading @@ -1448,10 +1448,14 @@ public class RadioManager { if (mService != null) { ITuner tuner; try { tuner = mService.openTuner(); tuner = mService.openTuner(withAudio); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } if (tuner == null) { Log.e(TAG, "Failed to open tuner"); return null; } return new TunerAdapter(tuner); } Loading
core/java/android/hardware/radio/TunerAdapter.java +13 −2 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ class TunerAdapter extends RadioTuner { private static final String TAG = "radio.TunerAdapter"; @NonNull private final ITuner mTuner; private boolean mIsClosed = false; TunerAdapter(ITuner tuner) { if (tuner == null) { Loading @@ -41,8 +42,18 @@ class TunerAdapter extends RadioTuner { @Override public void close() { // TODO(b/36863239): forward to mTuner Log.w(TAG, "Close call not implemented"); synchronized (mTuner) { if (mIsClosed) { Log.d(TAG, "Tuner is already closed"); return; } mIsClosed = true; } try { mTuner.close(); } catch (RemoteException e) { Log.e(TAG, "Exception trying to close tuner", e); } } @Override Loading
services/core/java/com/android/server/radio/RadioService.java +21 −13 Original line number Diff line number Diff line Loading @@ -28,29 +28,37 @@ public class RadioService extends SystemService { // TODO(b/36863239): rename to RadioService when native service goes away private static final String TAG = "RadioServiceJava"; private final RadioServiceImpl mServiceImpl = new RadioServiceImpl(); /** * This field is used by native code, do not access or modify. */ private final long mNativeContext = nativeInit(); public RadioService(Context context) { super(context); } @Override public void onStart() { publishBinderService(Context.RADIO_SERVICE, new RadioServiceImpl()); Slog.v(TAG, "RadioService started"); protected void finalize() throws Throwable { nativeFinalize(mNativeContext); super.finalize(); } private static class RadioServiceImpl extends IRadioService.Stub { private native long nativeInit(); private native void nativeFinalize(long nativeContext); private native Tuner openTunerNative(long nativeContext, boolean withAudio); @Override public ITuner openTuner() { Slog.d(TAG, "openTuner()"); return new TunerImpl(); } public void onStart() { publishBinderService(Context.RADIO_SERVICE, mServiceImpl); Slog.v(TAG, "RadioService started"); } private static class TunerImpl extends ITuner.Stub { private class RadioServiceImpl extends IRadioService.Stub { @Override public int getProgramInformation(RadioManager.ProgramInfo[] infoOut) { Slog.d(TAG, "getProgramInformation()"); return RadioManager.STATUS_INVALID_OPERATION; public ITuner openTuner(boolean withAudio) { return openTunerNative(mNativeContext, withAudio); } } }