Merge pi-dev-plus-aosp-without-vendor into stage-dr1-aosp-master
Bug: 111615259
Change-Id: Ib872033a7610ceca056c7a67ec04df4f5ff839fa
diff --git a/Android.mk b/Android.mk
index 5195a10..982b031 100644
--- a/Android.mk
+++ b/Android.mk
@@ -40,12 +40,16 @@
LOCAL_JAVA_LIBRARIES += android.car
LOCAL_STATIC_ANDROID_LIBRARIES += \
- android-support-car \
- android-support-constraint-layout \
+ androidx.car_car \
+ androidx-constraintlayout_constraintlayout \
car-apps-common \
car-broadcastradio-support \
car-stream-ui-lib
+# Dependency for bcradio-android-arch-room-runtime-nodeps
+LOCAL_STATIC_ANDROID_LIBRARIES += \
+ android-support-v4
+
LOCAL_STATIC_JAVA_LIBRARIES := \
android-arch-lifecycle-livedata \
android-arch-persistence-db-framework \
diff --git a/res/layout/manual_tuner.xml b/res/layout/manual_tuner.xml
index c74f201..fb1f203 100644
--- a/res/layout/manual_tuner.xml
+++ b/res/layout/manual_tuner.xml
@@ -15,7 +15,7 @@
-->
<!-- This Layout is clickable so that clicks do not fall through to the underlying
fragment. -->
-<android.support.constraint.ConstraintLayout
+<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_marginTop="@dimen/car_app_bar_height"
@@ -24,7 +24,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
- <android.support.constraint.Guideline
+ <androidx.constraintlayout.widget.Guideline
android:id="@+id/center_guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -96,4 +96,4 @@
app:layout_constraintStart_toEndOf="@+id/manual_tuner_done_button"
app:layout_constraintBottom_toBottomOf="@+id/manual_tuner_done_button"
android:src="@drawable/ic_backspace" />
-</android.support.constraint.ConstraintLayout>
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/res/layout/radio_fragment.xml b/res/layout/radio_fragment.xml
index 87de2ad..c8cca15 100644
--- a/res/layout/radio_fragment.xml
+++ b/res/layout/radio_fragment.xml
@@ -95,7 +95,7 @@
android:visibility="invisible" />
</LinearLayout>
- <android.support.v7.widget.CardView
+ <androidx.cardview.widget.CardView
android:id="@+id/radio_layout_container"
android:layout_gravity="center_horizontal"
android:transitionName="@string/radio_controls_transition_name"
@@ -104,6 +104,6 @@
app:cardBackgroundColor="@color/car_card" >
<include layout="@layout/radio_controls" />
- </android.support.v7.widget.CardView>
+ </androidx.cardview.widget.CardView>
</LinearLayout>
</FrameLayout>
diff --git a/res/layout/radio_presets_list.xml b/res/layout/radio_presets_list.xml
index e67b038..06064dc 100644
--- a/res/layout/radio_presets_list.xml
+++ b/res/layout/radio_presets_list.xml
@@ -53,7 +53,7 @@
app:alignDividerEndTo="@id/current_radio_station_card_controls"
app:alignDividerStartTo="@id/current_radio_station_card_controls" />
- <android.support.v7.widget.CardView
+ <androidx.cardview.widget.CardView
android:id="@+id/current_radio_station_card"
android:layout_gravity="bottom|center_horizontal"
android:layout_width="match_parent"
@@ -126,5 +126,5 @@
</RelativeLayout>
<include layout="@layout/radio_controls" />
- </android.support.v7.widget.CardView>
+ </androidx.cardview.widget.CardView>
</FrameLayout>
diff --git a/src/com/android/car/radio/CarRadioActivity.java b/src/com/android/car/radio/CarRadioActivity.java
index 642e995..63a0e2c 100644
--- a/src/com/android/car/radio/CarRadioActivity.java
+++ b/src/com/android/car/radio/CarRadioActivity.java
@@ -21,14 +21,14 @@
import android.hardware.radio.ProgramSelector;
import android.hardware.radio.RadioManager;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentManager;
import android.util.Log;
import android.util.Pair;
import androidx.car.drawer.CarDrawerActivity;
import androidx.car.drawer.CarDrawerAdapter;
import androidx.car.drawer.DrawerItemViewHolder;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
import java.util.ArrayList;
import java.util.List;
@@ -61,7 +61,7 @@
/**
* Whether or not it is safe to make transactions on the
- * {@link android.support.v4.app.FragmentManager}. This variable prevents a possible exception
+ * {@link androidx.fragment.app.FragmentManager}. This variable prevents a possible exception
* when calling commit() on the FragmentManager.
*
* <p>The default value is {@code true} because it is only after
diff --git a/src/com/android/car/radio/MainRadioFragment.java b/src/com/android/car/radio/MainRadioFragment.java
index 109d425..d7ebb94 100644
--- a/src/com/android/car/radio/MainRadioFragment.java
+++ b/src/com/android/car/radio/MainRadioFragment.java
@@ -18,12 +18,13 @@
import android.animation.ObjectAnimator;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.view.animation.FastOutSlowInInterpolator;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import androidx.fragment.app.Fragment;
+import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
+
/**
* A fragment that functions as the main display of the information relating to the current radio
* station. It also displays controls that allows the user to switch to different radio stations.
diff --git a/src/com/android/car/radio/ManualTunerFragment.java b/src/com/android/car/radio/ManualTunerFragment.java
index 6c58eb2..5eb01f4 100644
--- a/src/com/android/car/radio/ManualTunerFragment.java
+++ b/src/com/android/car/radio/ManualTunerFragment.java
@@ -19,11 +19,12 @@
import android.hardware.radio.ProgramSelector;
import android.hardware.radio.RadioManager;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import androidx.fragment.app.Fragment;
+
/**
* A fragment that allows the user to manually input a radio station to tune to.
*/
diff --git a/src/com/android/car/radio/PlayPauseButton.java b/src/com/android/car/radio/PlayPauseButton.java
index 0e1f82d..2f1cb75 100644
--- a/src/com/android/car/radio/PlayPauseButton.java
+++ b/src/com/android/car/radio/PlayPauseButton.java
@@ -28,8 +28,8 @@
public class PlayPauseButton extends ImageView {
private static final String TAG = "Em.PlayPauseButton";
- private final int[] STATE_PLAYING = {R.attr.state_playing};
- private final int[] STATE_PAUSED = {R.attr.state_paused};
+ private static final int[] STATE_PLAYING = {R.attr.state_playing};
+ private static final int[] STATE_PAUSED = {R.attr.state_paused};
private int mPlaybackState = -1;
@@ -40,16 +40,9 @@
/**
* Set the current play state of the button.
*
- * @param playState One of the values from {@link PlaybackState}. Only
- * {@link PlaybackState#STATE_PAUSED} and {@link PlaybackState#STATE_PLAYING}
- * are valid.
+ * @param playState One of the values from {@link PlaybackState}.
*/
public void setPlayState(int playState) {
- if (playState != PlaybackState.STATE_PAUSED && playState != PlaybackState.STATE_PLAYING) {
- throw new IllegalArgumentException("Playback state should be either "
- + "PlaybackState.STATE_PAUSED or PlaybackState.STATE_PLAYING");
- }
-
mPlaybackState = playState;
}
@@ -62,11 +55,14 @@
case PlaybackState.STATE_PLAYING:
mergeDrawableStates(drawableState, STATE_PLAYING);
break;
+ case PlaybackState.STATE_NONE:
case PlaybackState.STATE_PAUSED:
+ case PlaybackState.STATE_STOPPED:
+ case PlaybackState.STATE_CONNECTING:
mergeDrawableStates(drawableState, STATE_PAUSED);
break;
default:
- Log.e(TAG, "Unknown PlaybackState: " + mPlaybackState);
+ Log.e(TAG, "Unsupported PlaybackState: " + mPlaybackState);
}
if (getBackground() != null) {
getBackground().setState(drawableState);
diff --git a/src/com/android/car/radio/PresetListScrollListener.java b/src/com/android/car/radio/PresetListScrollListener.java
index 527fda8..aae026a 100644
--- a/src/com/android/car/radio/PresetListScrollListener.java
+++ b/src/com/android/car/radio/PresetListScrollListener.java
@@ -18,11 +18,11 @@
import android.animation.ValueAnimator;
import android.content.Context;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
import android.view.View;
import androidx.car.widget.PagedListView;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
/**
* Listener on the preset list that will add elevation on the container holding the current
diff --git a/src/com/android/car/radio/PresetsAdapter.java b/src/com/android/car/radio/PresetsAdapter.java
index 3c1de48..a7fd198 100644
--- a/src/com/android/car/radio/PresetsAdapter.java
+++ b/src/com/android/car/radio/PresetsAdapter.java
@@ -18,13 +18,13 @@
import android.annotation.Nullable;
import android.hardware.radio.ProgramSelector;
-import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.car.widget.PagedListView;
+import androidx.recyclerview.widget.RecyclerView;
import com.android.car.broadcastradio.support.Program;
diff --git a/src/com/android/car/radio/PresetsViewHolder.java b/src/com/android/car/radio/PresetsViewHolder.java
index a34be3f..82fcf7b 100644
--- a/src/com/android/car/radio/PresetsViewHolder.java
+++ b/src/com/android/car/radio/PresetsViewHolder.java
@@ -20,12 +20,13 @@
import android.content.Context;
import android.graphics.drawable.GradientDrawable;
import android.hardware.radio.ProgramSelector;
-import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;
+import androidx.recyclerview.widget.RecyclerView;
+
import com.android.car.broadcastradio.support.Program;
import com.android.car.broadcastradio.support.platform.ProgramSelectorExt;
import com.android.car.view.CardListBackgroundResolver;
diff --git a/src/com/android/car/radio/RadioAnimationManager.java b/src/com/android/car/radio/RadioAnimationManager.java
index 50efe97..f5bba3f 100644
--- a/src/com/android/car/radio/RadioAnimationManager.java
+++ b/src/com/android/car/radio/RadioAnimationManager.java
@@ -24,8 +24,6 @@
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Point;
-import android.support.v4.view.animation.FastOutSlowInInterpolator;
-import android.support.v7.widget.CardView;
import android.view.Display;
import android.view.View;
import android.view.ViewGroup;
@@ -33,6 +31,8 @@
import android.view.WindowManager;
import androidx.car.utils.ColumnCalculator;
+import androidx.cardview.widget.CardView;
+import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
/**
* A animation manager that is responsible for the start and exiting animation for the
diff --git a/src/com/android/car/radio/RadioController.java b/src/com/android/car/radio/RadioController.java
index 713f64b..8bec5d0 100644
--- a/src/com/android/car/radio/RadioController.java
+++ b/src/com/android/car/radio/RadioController.java
@@ -32,7 +32,6 @@
import android.hardware.radio.RadioManager.ProgramInfo;
import android.hardware.radio.RadioMetadata;
import android.hardware.radio.RadioTuner;
-import android.media.AudioManager;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
@@ -98,20 +97,13 @@
private final RadioDisplayController mRadioDisplayController;
- /**
- * Keeps track of if the user has manually muted the radio. This value is used to determine
- * whether or not to un-mute the radio after an {@link AudioManager#AUDIOFOCUS_LOSS_TRANSIENT}
- * event has been received.
- */
- private boolean mUserHasMuted;
-
private final RadioStorage mRadioStorage;
private final String mAmBandString;
private final String mFmBandString;
- private List<ProgramInfoChangeListener> mProgramInfoChangeListeners = new ArrayList<>();
- private List<RadioServiceConnectionListener> mRadioServiceConnectionListeners =
+ private final List<ProgramInfoChangeListener> mProgramInfoChangeListeners = new ArrayList<>();
+ private final List<RadioServiceConnectionListener> mRadioServiceConnectionListeners =
new ArrayList<>();
/**
@@ -255,9 +247,6 @@
try {
mRadioDisplayController.setSingleChannelDisplay(mRadioBackground);
- // Ensure the play button properly reflects the current mute state.
- mRadioDisplayController.setPlayPauseButtonState(mRadioManager.isMuted());
-
// TODO(b/73950974): use callback only
ProgramInfo current = mRadioManager.getCurrentProgramInfo();
if (current != null) mCallback.onCurrentProgramInfoChanged(current);
@@ -442,18 +431,6 @@
}
/**
- * Closes any active {@link RadioTuner}s and releases audio focus.
- */
- private void close() {
- if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "close()");
- }
-
- // Lost focus, so display that the radio is not playing anymore.
- mRadioDisplayController.setPlayPauseButtonState(true);
- }
-
- /**
* Closes all active connections in the {@link RadioController}.
*/
public void shutdown() {
@@ -471,8 +448,6 @@
Log.e(TAG, "tuneToRadioChannel(); remote exception: " + e.getMessage());
}
}
-
- close();
}
@Override
@@ -515,23 +490,10 @@
mRadioDisplayController.setChannelIsPreset(mRadioStorage.isPreset(sel));
// Notify that the current radio station has changed.
- if (mProgramInfoChangeListeners != null) {
- for (ProgramInfoChangeListener listener : mProgramInfoChangeListeners) {
- listener.onProgramInfoChanged(info);
- }
+ for (ProgramInfoChangeListener listener : mProgramInfoChangeListeners) {
+ listener.onProgramInfoChanged(info);
}
}
-
- @Override
- public void onRadioMuteChanged(boolean isMuted) {
- mRadioDisplayController.setPlayPauseButtonState(isMuted);
- }
-
- @Override
- public void onError(int status) {
- Log.e(TAG, "Radio callback error with status: " + status);
- close();
- }
};
private final View.OnClickListener mBackwardSeekClickListener = new View.OnClickListener() {
@@ -587,11 +549,6 @@
} else {
mRadioManager.mute();
}
-
- boolean isMuted = mRadioManager.isMuted();
-
- mUserHasMuted = isMuted;
- mRadioDisplayController.setPlayPauseButtonState(isMuted);
} catch (RemoteException e) {
Log.e(TAG, "playPauseClickListener(); remote exception: " + e.getMessage());
}
@@ -638,6 +595,7 @@
}
mRadioDisplayController.setEnabled(true);
+ mRadioManager.addPlaybackStateListener(mRadioDisplayController);
if (mRadioErrorDisplay != null) {
mRadioErrorDisplay.setVisibility(View.GONE);
diff --git a/src/com/android/car/radio/RadioDisplayController.java b/src/com/android/car/radio/RadioDisplayController.java
index f9b1b7e..9c1179a 100644
--- a/src/com/android/car/radio/RadioDisplayController.java
+++ b/src/com/android/car/radio/RadioDisplayController.java
@@ -17,17 +17,20 @@
package com.android.car.radio;
import android.content.Context;
-import android.media.session.PlaybackState;
+import android.support.v4.media.session.PlaybackStateCompat;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewStub;
import android.widget.ImageView;
import android.widget.TextView;
+import com.android.car.radio.audio.IPlaybackStateListener;
+import com.android.car.radio.utils.LocalInterface;
+
/**
* Controller that controls the appearance state of various UI elements in the radio.
*/
-public class RadioDisplayController {
+public class RadioDisplayController implements IPlaybackStateListener, LocalInterface {
private final Context mContext;
private TextView mChannelBand;
@@ -225,21 +228,15 @@
}
}
- /**
- * Sets the current state of the play button. If the given {@code muted} value is {@code true},
- * then the button display a play icon. If {@code false}, then the button will display a
- * pause icon.
- */
- public void setPlayPauseButtonState(boolean muted) {
+ @Override
+ public void onPlaybackStateChanged(@PlaybackStateCompat.State int state) {
if (mPlayButton != null) {
- mPlayButton.setPlayState(muted
- ? PlaybackState.STATE_PAUSED : PlaybackState.STATE_PLAYING);
+ mPlayButton.setPlayState(state);
mPlayButton.refreshDrawableState();
}
if (mPresetPlayButton != null) {
- mPresetPlayButton.setPlayState(muted
- ? PlaybackState.STATE_PAUSED : PlaybackState.STATE_PLAYING);
+ mPresetPlayButton.setPlayState(state);
mPresetPlayButton.refreshDrawableState();
}
}
diff --git a/src/com/android/car/radio/RadioPresetsFragment.java b/src/com/android/car/radio/RadioPresetsFragment.java
index a022c4a..6f1601d 100644
--- a/src/com/android/car/radio/RadioPresetsFragment.java
+++ b/src/com/android/car/radio/RadioPresetsFragment.java
@@ -23,7 +23,6 @@
import android.content.Context;
import android.hardware.radio.RadioManager.ProgramInfo;
import android.os.Bundle;
-import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -31,6 +30,7 @@
import androidx.car.widget.DayNightStyle;
import androidx.car.widget.PagedListView;
+import androidx.fragment.app.Fragment;
import com.android.car.broadcastradio.support.Program;
import com.android.car.radio.storage.RadioStorage;
diff --git a/src/com/android/car/radio/RadioService.java b/src/com/android/car/radio/RadioService.java
index fc5a9ad..e51a2ab 100644
--- a/src/com/android/car/radio/RadioService.java
+++ b/src/com/android/car/radio/RadioService.java
@@ -28,10 +28,10 @@
import android.os.IBinder;
import android.os.RemoteException;
import android.support.v4.media.MediaBrowserCompat.MediaItem;
-import android.support.v4.media.MediaBrowserServiceCompat;
-import android.support.v4.media.session.PlaybackStateCompat;
import android.util.Log;
+import androidx.media.MediaBrowserServiceCompat;
+
import com.android.car.broadcastradio.support.Program;
import com.android.car.broadcastradio.support.media.BrowseTree;
import com.android.car.broadcastradio.support.platform.ProgramSelectorExt;
@@ -43,6 +43,7 @@
import com.android.car.radio.service.IRadioCallback;
import com.android.car.radio.service.IRadioManager;
import com.android.car.radio.storage.RadioStorage;
+import com.android.car.radio.utils.LocalInterface;
import java.util.ArrayList;
import java.util.HashSet;
@@ -57,7 +58,7 @@
*
* <p>Utilize the {@link RadioBinder} to perform radio operations.
*/
-public class RadioService extends MediaBrowserServiceCompat implements IPlaybackStateListener {
+public class RadioService extends MediaBrowserServiceCompat implements LocalInterface {
private static String TAG = "BcRadioApp.uisrv";
@@ -137,8 +138,6 @@
mRadioStorage.addPresetsChangeListener(mPresetsListener);
onPresetsChanged();
- mAudioStreamController.addPlaybackStateListener(this);
-
openRadioBandInternal(mRadioStorage.getStoredRadioBand());
mRadioSuccessfullyInitialized = true;
@@ -215,23 +214,6 @@
}
}
- /* TODO(b/73950974): remove onRadioMuteChanged from IRadioCallback,
- * use IPlaybackStateListener directly.
- */
- @Override
- public void onPlaybackStateChanged(@PlaybackStateCompat.State int state) {
- boolean muted = state != PlaybackStateCompat.STATE_PLAYING;
- synchronized (mLock) {
- for (IRadioCallback callback : mRadioTunerCallbacks) {
- try {
- callback.onRadioMuteChanged(muted);
- } catch (RemoteException e) {
- Log.e(TAG, "Mute state change callback failed", e);
- }
- }
- }
- }
-
/**
* Closes any active {@link RadioTuner}s and releases audio focus.
*/
@@ -378,6 +360,16 @@
return mCurrentProgram;
}
+ @Override
+ public void addPlaybackStateListener(IPlaybackStateListener callback) {
+ mAudioStreamController.addPlaybackStateListener(callback);
+ }
+
+ @Override
+ public void removePlaybackStateListener(IPlaybackStateListener callback) {
+ mAudioStreamController.removePlaybackStateListener(callback);
+ }
+
/**
* Returns {@code true} if the radio was able to successfully initialize. A value of
* {@code false} here could mean that the {@code RadioService} was not able to connect to
@@ -441,14 +433,6 @@
mReOpenRadioTunerCount++;
}
-
- try {
- for (IRadioCallback callback : mRadioTunerCallbacks) {
- callback.onError(status);
- }
- } catch (RemoteException e) {
- Log.e(TAG, "onError(); Failed to notify IRadioCallbacks: " + e.getMessage());
- }
}
@Override
@@ -493,9 +477,4 @@
return super.onStartCommand(intent, flags, startId);
}
-
- @Override
- public IBinder asBinder() {
- throw new UnsupportedOperationException("Not a binder");
- }
}
diff --git a/src/com/android/car/radio/media/TunerSession.java b/src/com/android/car/radio/media/TunerSession.java
index 3b77057..a565046 100644
--- a/src/com/android/car/radio/media/TunerSession.java
+++ b/src/com/android/car/radio/media/TunerSession.java
@@ -23,7 +23,6 @@
import android.hardware.radio.RadioManager.ProgramInfo;
import android.net.Uri;
import android.os.Bundle;
-import android.os.IBinder;
import android.os.RemoteException;
import android.support.v4.media.MediaMetadataCompat;
import android.support.v4.media.RatingCompat;
@@ -39,6 +38,7 @@
import com.android.car.radio.R;
import com.android.car.radio.audio.IPlaybackStateListener;
import com.android.car.radio.service.IRadioManager;
+import com.android.car.radio.utils.LocalInterface;
import com.android.car.radio.utils.ThrowingRunnable;
import java.util.Objects;
@@ -46,7 +46,8 @@
/**
* Implementation of tuner's MediaSession.
*/
-public class TunerSession extends MediaSessionCompat implements IPlaybackStateListener {
+public class TunerSession extends MediaSessionCompat
+ implements IPlaybackStateListener, LocalInterface {
private static final String TAG = "BcRadioApp.msess";
private final Object mLock = new Object();
@@ -191,9 +192,4 @@
}
}
}
-
- @Override
- public IBinder asBinder() {
- throw new UnsupportedOperationException("Not a binder");
- }
}
diff --git a/src/com/android/car/radio/service/IRadioCallback.aidl b/src/com/android/car/radio/service/IRadioCallback.aidl
index d1ecf93..95bab45 100644
--- a/src/com/android/car/radio/service/IRadioCallback.aidl
+++ b/src/com/android/car/radio/service/IRadioCallback.aidl
@@ -29,19 +29,4 @@
* @param info The current program info.
*/
void onCurrentProgramInfoChanged(in RadioManager.ProgramInfo info);
-
- /**
- * Called when the mute state of the radio has changed.
- *
- * @param isMuted {@code true} if the radio is muted.
- */
- void onRadioMuteChanged(boolean isMuted);
-
- /**
- * Called when the radio has encountered an error.
- *
- * @param status One of the error states in {@link RadioManager}. For example,
- * {@link RadioManager#ERROR_HARDWARE_FAILURE}.
- */
- void onError(int status);
}
diff --git a/src/com/android/car/radio/service/IRadioManager.aidl b/src/com/android/car/radio/service/IRadioManager.aidl
index ba005ba..4902c4b 100644
--- a/src/com/android/car/radio/service/IRadioManager.aidl
+++ b/src/com/android/car/radio/service/IRadioManager.aidl
@@ -19,6 +19,7 @@
import android.hardware.radio.RadioManager;
import com.android.car.broadcastradio.support.Program;
+import com.android.car.radio.audio.IPlaybackStateListener;
import com.android.car.radio.service.IRadioCallback;
/**
@@ -96,6 +97,16 @@
RadioManager.ProgramInfo getCurrentProgramInfo();
/**
+ * Adds {@link IPlaybackStateListener} listener for play/pause notifications.
+ */
+ void addPlaybackStateListener(in IPlaybackStateListener callback);
+
+ /**
+ * Removes {@link IPlaybackStateListener} listener.
+ */
+ void removePlaybackStateListener(in IPlaybackStateListener callback);
+
+ /**
* Returns {@code true} if the radio was able to successfully initialize. A value of
* {@code false} here could mean that the {@code RadioService} was not able to connect to
* the {@link RadioManager} or there were no radio modules on the current device.
diff --git a/src/com/android/car/radio/utils/LocalInterface.java b/src/com/android/car/radio/utils/LocalInterface.java
new file mode 100644
index 0000000..ddc9fa7
--- /dev/null
+++ b/src/com/android/car/radio/utils/LocalInterface.java
@@ -0,0 +1,34 @@
+/**
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.car.radio.utils;
+
+import android.os.IBinder;
+import android.os.IInterface;
+
+/**
+ * Marks given I-Class as not-a-binder.
+ *
+ * It saves some copy-pasting for interfaces that are not meant to be used cross-process.
+ */
+public interface LocalInterface extends IInterface {
+ /**
+ * Dummy implementation of {@link IInterface#asBinder}.
+ */
+ default IBinder asBinder() {
+ throw new UnsupportedOperationException("Not a binder");
+ }
+}