Merge "Extend DeviceRouteController API with selectRoute method" into udc-dev
This commit is contained in:
@@ -17,8 +17,10 @@
|
|||||||
package com.android.server.media;
|
package com.android.server.media;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.Nullable;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
|
import android.media.IAudioRoutesObserver;
|
||||||
import android.media.IAudioService;
|
import android.media.IAudioService;
|
||||||
import android.media.MediaRoute2Info;
|
import android.media.MediaRoute2Info;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
@@ -48,6 +50,19 @@ import android.os.ServiceManager;
|
|||||||
onDeviceRouteChangedListener);
|
onDeviceRouteChangedListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select the route with the given built-in or wired {@link MediaRoute2Info.Type}.
|
||||||
|
*
|
||||||
|
* <p>If the type is {@code null} then unselects the route and falls back to the default device
|
||||||
|
* route observed from
|
||||||
|
* {@link com.android.server.audio.AudioService#startWatchingRoutes(IAudioRoutesObserver)}.
|
||||||
|
*
|
||||||
|
* @param type device type. May be {@code null} to unselect currently selected route.
|
||||||
|
* @return whether the selection succeeds. If the selection fails the state of the controller
|
||||||
|
* remains intact.
|
||||||
|
*/
|
||||||
|
boolean selectRoute(@Nullable @MediaRoute2Info.Type Integer type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns currently selected device (built-in or wired) route.
|
* Returns currently selected device (built-in or wired) route.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -99,6 +99,12 @@ import java.util.Objects;
|
|||||||
mDeviceRoute = createRouteFromAudioInfo(newAudioRoutes);
|
mDeviceRoute = createRouteFromAudioInfo(newAudioRoutes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean selectRoute(@Nullable Integer type) {
|
||||||
|
// No-op as the controller does not support selection from the outside of the class.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@NonNull
|
||||||
public synchronized MediaRoute2Info getDeviceRoute() {
|
public synchronized MediaRoute2Info getDeviceRoute() {
|
||||||
|
|||||||
Reference in New Issue
Block a user