More interface details for the cast framework

This commit is contained in:
Adam Mills 2018-04-18 12:53:39 -04:00 committed by Marvin W
parent 64d76cee70
commit 718b9071a9
13 changed files with 172 additions and 21 deletions

View File

@ -16,8 +16,47 @@
package com.google.android.gms.common.images;
import android.net.Uri;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class WebImage extends AutoSafeParcelable {
public static final Creator<WebImage> CREATOR = new AutoCreator<WebImage>(WebImage.class);
public WebImage (Uri uri) {
this.uri = uri;
}
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
private final Uri uri;
@SafeParceled(3)
private final int width = 0;
@SafeParceled(4)
private final int height = 0;
public Uri getUrl()
{
return uri;
}
public int getWidth()
{
return width;
}
public int getHeight()
{
return height;
}
public String toString()
{
return String.format("Image %dx%d %s", new Object[] { Integer.valueOf(width), Integer.valueOf(height), uri.toString() });
}
}

View File

@ -33,6 +33,10 @@ import java.util.List;
public class CastDevice extends AutoSafeParcelable {
private static final String EXTRA_CAST_DEVICE = "com.google.android.gms.cast.EXTRA_CAST_DEVICE";
public CastDevice (String deviceId) {
this.deviceId = deviceId;
}
/**
* Video-output device capability.
*/
@ -78,12 +82,15 @@ public class CastDevice extends AutoSafeParcelable {
@SafeParceled(value = 8, subClass = WebImage.class)
private ArrayList<WebImage> icons;
@SafeParceled(8)
@SafeParceled(9)
private int capabilities;
@SafeParceled(9)
@SafeParceled(10)
private int status;
@SafeParceled(11)
private String unknown; // TODO: Need to figure this one out
public String getDeviceId() {
return deviceId;
}
@ -125,7 +132,12 @@ public class CastDevice extends AutoSafeParcelable {
}
public boolean hasCapabilities(int[] capabilities) {
return false;
for (int capability : capabilities) {
if (!this.hasCapability(capability)) {
return false;
}
}
return true;
}
public boolean hasCapability(int capability) {

View File

@ -1,15 +1,20 @@
package com.google.android.gms.cast.framework;
import com.google.android.gms.cast.framework.ISessionManager;
import com.google.android.gms.cast.framework.IDiscoveryManager;
import com.google.android.gms.dynamic.IObjectWrapper;
interface ICastContext {
Bundle getMergedSelectorAsBundle() = 0;
boolean isApplicationVisible() = 1;
//void addAppVisibilityListener(IAppVisibilityListener listener) = 2;
//void removeAppVisibilityListener(IAppVisibilityListener listener) = 3;
ISessionManager getSessionManager() = 4;
void destroy() = 5;
void onActivityResumed(in IObjectWrapper activity) = 6;
void onActivityPaused(in IObjectWrapper activity) = 7;
}
//void removeAppVisibilityListener(IAppVisibilityListener listener) = 2;
//void addAppVisibilityListener(IAppVisibilityListener listener) = 3;
ISessionManager getSessionManagerImpl() = 4;
IDiscoveryManager getDiscoveryManagerImpl() = 5;
void destroy() = 6;
void onActivityResumed(in IObjectWrapper activity) = 7;
void onActivityPaused(in IObjectWrapper activity) = 8;
IObjectWrapper getWrappedThis() = 9;
void unknown(String s1, in Map m1) = 10; // TODO
}

View File

@ -0,0 +1,8 @@
package com.google.android.gms.cast.framework;
import com.google.android.gms.dynamic.IObjectWrapper;
interface ICastStateListener {
IObjectWrapper getWrappedThis() = 0;
void onCastStateChanged(int newState) = 1;
}

View File

@ -0,0 +1,12 @@
package com.google.android.gms.cast.framework;
import com.google.android.gms.cast.framework.IDiscoveryManagerListener;
import com.google.android.gms.dynamic.IObjectWrapper;
interface IDiscoveryManager {
void startDiscovery() = 0; // Maybe?
void stopDiscovery() = 1; // Maybe?
void addDiscoveryManagerListener(IDiscoveryManagerListener listener) = 2;
void removeDiscoveryManagerListener(IDiscoveryManagerListener listener) = 3;
IObjectWrapper getWrappedThis() = 4;
}

View File

@ -0,0 +1,8 @@
package com.google.android.gms.cast.framework;
import com.google.android.gms.dynamic.IObjectWrapper;
interface IDiscoveryManagerListener {
IObjectWrapper getWrappedThis() = 0;
void onDeviceAvailabilityChanged(boolean deviceAvailable) = 1;
}

View File

@ -1,5 +1,10 @@
package com.google.android.gms.cast.framework;
interface ISession {
import com.google.android.gms.dynamic.IObjectWrapper;
}
interface ISession {
IObjectWrapper getWrappedThis() = 0;
void notifySessionEnded(int error) = 5;
boolean isConnected() = 10;
boolean isResuming() = 14;
}

View File

@ -1,13 +1,15 @@
package com.google.android.gms.cast.framework;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.cast.framework.ISessionManagerListener;
import com.google.android.gms.cast.framework.ICastStateListener;
interface ISessionManager {
IObjectWrapper getWrappedCurrentSession() = 0;
//void addSessionManagerListener(ISessionManagerListener listener) = 1;
//void removeSessionManagerListener(ISessionManagerListener listener) = 2;
//void addCastStateListener(ICastStateListener listener) = 3;
//void removeCastStateListener(ICastStateListener listener) = 4;
void addSessionManagerListener(ISessionManagerListener listener) = 1;
void removeSessionManagerListener(ISessionManagerListener listener) = 2;
void addCastStateListener(ICastStateListener listener) = 3;
void removeCastStateListener(ICastStateListener listener) = 4;
void endCurrentSession(boolean b, boolean stopCasting) = 5;
IObjectWrapper getWrappedThis() = 6;
}
}

View File

@ -0,0 +1,16 @@
package com.google.android.gms.cast.framework;
import com.google.android.gms.dynamic.IObjectWrapper;
interface ISessionManagerListener {
IObjectWrapper getWrappedThis() = 0;
void onSessionStarting(IObjectWrapper session) = 1;
void onSessionStartFailed(IObjectWrapper session, int error) = 2;
void onSessionStarted(IObjectWrapper session, String sessionId) = 3;
void onSessionResumed(IObjectWrapper session, boolean wasSuspended) = 4;
void onSessionEnding(IObjectWrapper session) = 5;
void onSessionEnded(IObjectWrapper session, int error) = 6;
void onSessionResuming(IObjectWrapper session, String sessionId) = 7;
void onSessionResumeFailed(IObjectWrapper session, int error) = 8;
void onSessionSuspended(IObjectWrapper session, int reason) = 9;
}

View File

@ -0,0 +1,9 @@
package com.google.android.gms.cast.framework;
import com.google.android.gms.dynamic.IObjectWrapper;
interface ISessionProvider {
IObjectWrapper getWrappedSession(String id) = 0;
boolean isSessionRecoverable() = 1;
String getCategory() = 2;
}

View File

@ -1,5 +1,15 @@
package com.google.android.gms.cast.framework;
interface ISessionProxy {
import com.google.android.gms.dynamic.IObjectWrapper;
}
// TODO: Functionality still needs to be determined
interface ISessionProxy {
IObjectWrapper getWrappedThis() = 0;
void method1(in Bundle paramBundle) = 1;
void method2(in Bundle paramBundle) = 2;
void method3(boolean paramBoolean) = 3;
long method4() = 4;
int method5() = 5;
void method6(in Bundle paramBundle) = 6;
void method7(in Bundle paramBundle) = 7;
}

View File

@ -1,5 +1,18 @@
package com.google.android.gms.cast.framework.internal;
interface IMediaRouter {
import android.os.Bundle;
}
import com.google.android.gms.cast.framework.internal.IMediaRouterCallback;
interface IMediaRouter {
void registerMediaRouterCallbackImpl(in Bundle selector, IMediaRouterCallback callback) = 0;
void addCallback(in Bundle selector, int flags) = 1;
void removeCallback(in Bundle selector) = 2;
boolean isRouteAvailable(in Bundle selector, int flags) = 3;
void selectRouteById(String routeId) = 4;
void selectDefaultRoute() = 5;
boolean isDefaultRouteSelected() = 6; // Maybe?
Bundle getRouteInfoExtrasById(String routeId) = 7;
String hashKey() = 8; // Maybe?
void clearCallbacks() = 10;
}

View File

@ -0,0 +1,12 @@
package com.google.android.gms.cast.framework.internal;
import android.os.Bundle;
interface IMediaRouterCallback {
void onRouteAdded(String routeId, in Bundle extras) = 0;
void onRouteChanged(String routeId, in Bundle extras) = 1;
void onRouteRemoved(String routeId, in Bundle extras) = 2;
void onRouteSelected(String routeId, in Bundle extras) = 3;
void unknown(String routeId, in Bundle extras) = 4;
void onRouteUnselected(String routeId, in Bundle extras, int reason) = 5;
}