Cast MVP to start videos

This commit is contained in:
Adam Mills 2018-05-19 15:19:25 -04:00 committed by Marvin W
parent 18a50244ff
commit 377e608fa7
31 changed files with 454 additions and 41 deletions

View File

@ -0,0 +1,3 @@
package com.google.android.gms.common.images;
parcelable WebImage;

View File

@ -24,7 +24,11 @@ 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) {
public WebImage () {
this.uri = null;
}
public WebImage (Uri uri) {
this.uri = uri;
}

View File

@ -31,7 +31,7 @@ import java.util.Arrays;
public class GetServiceRequest extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 2;
private int versionCode = 3;
@SafeParceled(2)
public final int serviceId;
@ -54,6 +54,9 @@ public class GetServiceRequest extends AutoSafeParcelable {
@SafeParceled(8)
public Account account;
@SafeParceled(9)
public long long1;
private GetServiceRequest() {
serviceId = -1;
gmsVersion = Constants.MAX_REFERENCE_VERSION;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.cast;
parcelable ApplicationMetadata;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.cast;
parcelable ApplicationStatus;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.cast;
parcelable CastDeviceStatus;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.cast;
parcelable JoinOptions;

View File

@ -0,0 +1,3 @@
package com.google.android.gms.cast;
parcelable LaunchOptions;

View File

@ -0,0 +1,14 @@
package com.google.android.gms.cast.internal;
import com.google.android.gms.cast.LaunchOptions;
import com.google.android.gms.cast.JoinOptions;
interface ICastDeviceController {
void disconnect() = 0;
void stopApplication(String sessionId) = 4;
void sendMessage(String namespace, String message, long requestId) = 8;
void registerNamespace(String namespace) = 10;
void unregisterNamespace(String namespace) = 11;
void launchApplication(String applicationId, in LaunchOptions launchOptions) = 12;
void joinApplication(String applicationId, String sessionId, in JoinOptions joinOptions) = 13;
}

View File

@ -0,0 +1,21 @@
package com.google.android.gms.cast.internal;
import com.google.android.gms.cast.ApplicationMetadata;
import com.google.android.gms.cast.ApplicationStatus;
import com.google.android.gms.cast.CastDeviceStatus;
interface ICastDeviceControllerListener {
void onDisconnected(int reason) = 0;
void onApplicationConnectionSuccess(in ApplicationMetadata applicationMetadata, String applicationStatus, String sessionId, boolean wasLaunched) = 1;
void onApplicationConnectionFailure(int statusCode) = 2;
// Deprecated: void onStatusReceived(String string1, double double1, boolean boolean1) = 3;
void onTextMessageReceived(String namespace, String message) = 4;
void onBinaryMessageReceived(String namespace, in byte[] data) = 5;
// void onStatusChanged(int status) = 6; // TODO
// void onStatusChanged2(int status) = 7; // TODO
void onApplicationDisconnected(int paramInt) = 8;
void onSendMessageFailure(String response, long requestId, int statusCode) = 9;
void onSendMessageSuccess(String response, long requestId) = 10;
void onApplicationStatusChanged(in ApplicationStatus applicationStatus) = 11;
void onDeviceStatusChanged(in CastDeviceStatus deviceStatus) = 12;
}

View File

@ -32,17 +32,17 @@ public class ApplicationMetadata extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
private String applicationId;
public String applicationId;
@SafeParceled(3)
private String name;
public String name;
@SafeParceled(value = 4, subClass = WebImage.class)
private List<WebImage> images;
public List<WebImage> images;
@SafeParceled(value = 5, subClass = String.class)
private List<String> namespaces;
public List<String> namespaces;
@SafeParceled(6)
private String senderAppIdentifier;
public String senderAppIdentifier;
@SafeParceled(7)
private Uri senderAppLaunchUri;
public Uri senderAppLaunchUri;
public String getApplicationId() {
return applicationId;
@ -64,5 +64,22 @@ public class ApplicationMetadata extends AutoSafeParcelable {
return namespaces.contains(namespace);
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("ApplicationMetadata{");
sb.append("applicationId='").append(applicationId).append("'");
sb.append(", name='").append(name).append("'");
sb.append(", images=").append(images.toString());
if (namespaces != null) {
sb.append(", namespaces=").append(namespaces.toString());
}
sb.append(", senderAppIdentifier='").append(senderAppIdentifier).append("'");
if (senderAppLaunchUri != null) {
sb.append(", senderAppLaunchUri='").append(senderAppLaunchUri.toString()).append("'");
}
sb.append('}');
return sb.toString();
}
public static final Creator<ApplicationMetadata> CREATOR = new AutoCreator<ApplicationMetadata>(ApplicationMetadata.class);
}

View File

@ -0,0 +1,30 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.google.android.gms.cast;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class ApplicationStatus extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
private String applicationStatus;
public static final Creator<ApplicationStatus> CREATOR = new AutoCreator<ApplicationStatus>(ApplicationStatus.class);
}

View File

@ -33,8 +33,12 @@ 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) {
public CastDevice () {
}
public CastDevice (String deviceId, String address) {
this.deviceId = deviceId;
this.address = address;
}
/**
@ -64,8 +68,7 @@ public class CastDevice extends AutoSafeParcelable {
private String deviceId;
@SafeParceled(3)
private String addrString;
private Inet4Address addr;
private String address;
@SafeParceled(4)
private String friendlyName;
@ -119,8 +122,8 @@ public class CastDevice extends AutoSafeParcelable {
return icons;
}
public Inet4Address getIpAddress() {
return addr;
public String getAddress() {
return address;
}
public String getModelName() {
@ -160,5 +163,20 @@ public class CastDevice extends AutoSafeParcelable {
bundle.putParcelable(EXTRA_CAST_DEVICE, this);
}
@Override
public String toString() {
return "CastDevice{" +
"deviceId=" + this.deviceId +
", address=" + address +
", friendlyName=" + friendlyName +
", modelName=" + modelName +
", deviceVersion=" + deviceVersion +
", servicePort=" + servicePort +
(icons == null ? "" : (", icons=" + icons.toString())) +
", capabilities=" + capabilities +
", status=" + status +
"}";
}
public static Creator<CastDevice> CREATOR = new AutoCreator<CastDevice>(CastDevice.class);
}

View File

@ -0,0 +1,38 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.google.android.gms.cast;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class CastDeviceStatus extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
private double volume;
@SafeParceled(3)
private boolean mute;
@SafeParceled(4)
private int activeInputState;
@SafeParceled(5)
private ApplicationMetadata applicationMetadata;
@SafeParceled(6)
private int standbyState;
public static final Creator<CastDeviceStatus> CREATOR = new AutoCreator<CastDeviceStatus>(CastDeviceStatus.class);
}

View File

@ -0,0 +1,29 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.google.android.gms.cast;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class JoinOptions extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
private int connectionType = 0;
public static Creator<JoinOptions> CREATOR = new AutoCreator<JoinOptions>(JoinOptions.class);
}

View File

@ -46,4 +46,5 @@ android {
dependencies {
api project(':play-services-basement')
api project(':play-services-cast-api')
}

View File

@ -1,9 +1,11 @@
package com.google.android.gms.cast.framework;
import com.google.android.gms.cast.LaunchOptions;
interface ICastConnectionController {
void joinApplication(String applicationId, String sessionId) = 0;
//void launchApplication(String applicationId, LaunchOptions options) = 1;
void launchApplication(String applicationId, in LaunchOptions launchOptions) = 1;
void stopApplication(String sessionId) = 2;
//void unknown(int i) = 3;
void closeConnection(int reason) = 3; // Maybe?
int getSupportedVersion() = 4;
}
}

View File

@ -1,5 +1,15 @@
package com.google.android.gms.cast.framework;
interface ICastSession {
import android.os.Bundle;
}
import com.google.android.gms.cast.ApplicationMetadata;
import com.google.android.gms.common.api.Status;
interface ICastSession {
void onConnected(in Bundle routeInfoExtra) = 0;
void onConnectionSuspended(int reason) = 1;
void onConnectionFailed(in Status status) = 2;
void onApplicationConnectionSuccess(in ApplicationMetadata applicationMetadata, String applicationStatus, String sessionId, boolean wasLaunched) = 3;
void onApplicationConnectionFailure(int statusCode) = 4;
void disconnectFromDevice(boolean boolean1, int int1) = 5;
}

View File

@ -6,16 +6,17 @@ interface ISession {
IObjectWrapper getWrappedObject() = 0;
String getCategory() = 1;
String getSessionId() = 2;
String getRouteId() = 3;
boolean isConnected() = 4;
boolean isConnecting() = 5;
boolean isDisconnecting() = 6;
boolean isDisconnected() = 7;
boolean isResuming() = 8;
boolean isSuspended() = 9;
void notifySessionStarted(String s) = 10;
void notifyFailedToStartSession(int e) = 11;
void notifySessionEnded(int e) = 12;
void notifySessionResumed(boolean b) = 13;
void notifyFailedToResumeSession(int e) = 14;
void notifySessionSuspended(int n) = 15;
void notifySessionStarted(String sessionId) = 10;
void notifyFailedToStartSession(int error) = 11;
void notifySessionEnded(int error) = 12;
void notifySessionResumed(boolean wasSuspended) = 13;
void notifyFailedToResumeSession(int error) = 14;
void notifySessionSuspended(int reason) = 15;
}

View File

@ -1,5 +1,7 @@
package com.google.android.gms.cast.framework;
import android.os.Bundle;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.cast.framework.ISessionManagerListener;
import com.google.android.gms.cast.framework.ICastStateListener;
@ -13,5 +15,5 @@ interface ISessionManager {
void endCurrentSession(boolean b, boolean stopCasting) = 5;
IObjectWrapper getWrappedThis() = 6;
int getCastState() = 7;
void startSession(in Bundle bundle) = 8;
void startSession(in Bundle options) = 8;
}

View File

@ -5,12 +5,12 @@ 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 onSessionStarted(IObjectWrapper session, String sessionId) = 2;
void onSessionStartFailed(IObjectWrapper session, int error) = 3;
void onSessionEnding(IObjectWrapper session) = 4;
void onSessionEnded(IObjectWrapper session, int error) = 5;
void onSessionResuming(IObjectWrapper session, String sessionId) = 6;
void onSessionResumed(IObjectWrapper session, boolean wasSuspended) = 7;
void onSessionResumeFailed(IObjectWrapper session, int error) = 8;
void onSessionSuspended(IObjectWrapper session, int reason) = 9;
int getSupportedVersion() = 10;

View File

@ -3,7 +3,7 @@ package com.google.android.gms.cast.framework;
import com.google.android.gms.dynamic.IObjectWrapper;
interface ISessionProvider {
IObjectWrapper getWrappedSession(String id) = 0;
IObjectWrapper getSession(String sessionId) = 0;
boolean isSessionRecoverable() = 1;
String getCategory() = 2;
int getSupportedVersion() = 3;

View File

@ -3,12 +3,12 @@ package com.google.android.gms.cast.framework;
import com.google.android.gms.dynamic.IObjectWrapper;
interface ISessionProxy {
IObjectWrapper getWrappedThis() = 0;
void start(in Bundle paramBundle) = 1;
void resume(in Bundle paramBundle) = 2;
IObjectWrapper getWrappedSession() = 0;
void start(in Bundle extras) = 1;
void resume(in Bundle extras) = 2;
void end(boolean paramBoolean) = 3;
long getSessionRemainingTimeMs() = 4;
int getSupportedVersion() = 5;
void onStarting(in Bundle paramBundle) = 6;
void onResuming(in Bundle paramBundle) = 7;
void onStarting(in Bundle routeInfoExtra) = 6;
void onResuming(in Bundle routeInfoExtra) = 7;
}

View File

@ -15,10 +15,10 @@ import com.google.android.gms.cast.framework.media.internal.IFetchBitmapTaskProg
import com.google.android.gms.dynamic.IObjectWrapper;
interface ICastDynamiteModule {
ICastContext newCastContextImpl(in IObjectWrapper context, in CastOptions options, IMediaRouter router, in Map map) = 0;
ISession newSessionImpl(String s1, String s2, ISessionProxy proxy) = 1;
ICastContext newCastContextImpl(in IObjectWrapper context, in CastOptions options, IMediaRouter router, in Map sessionProviders) = 0;
ISession newSessionImpl(String category, String sessionId, ISessionProxy proxy) = 1;
ICastSession newCastSessionImpl(in CastOptions options, in IObjectWrapper session, ICastConnectionController controller) = 2;
IMediaNotificationService newMediaNotificationServiceImpl(in IObjectWrapper service, in IObjectWrapper castContext, in IObjectWrapper resources, in CastMediaOptions options) = 3;
IReconnectionService newReconnectionServiceImpl(in IObjectWrapper service, in IObjectWrapper sessionManager, in IObjectWrapper discoveryManager) = 4;
IFetchBitmapTask newFetchBitmapTaskImpl(in IObjectWrapper asyncTask, IFetchBitmapTaskProgressPublisher progressPublisher, int i1, int i2, boolean b1, long l1, int i3, int i4, int i5) = 5;
}
}

View File

@ -0,0 +1,11 @@
package com.google.android.gms.cast.framework.media;
import com.google.android.gms.common.images.WebImage;
import com.google.android.gms.dynamic.IObjectWrapper;
interface IImagePicker {
// WebImage onPickImage(MediaMetadata metadata, int int1) = 0;
IObjectWrapper getWrappedClientObject() = 1;
int unknown1() = 2;
// WebImage onPickImage(MediaMetadata metadata, ImageHints imageHints) = 3;
}

View File

@ -0,0 +1,5 @@
package com.google.android.gms.cast.framework.media;
interface INotificationActionsProvider {
}

View File

@ -0,0 +1,3 @@
package com.google.android.gms.cast.framework.media;
parcelable NotificationOptions;

View File

@ -17,9 +17,49 @@
package com.google.android.gms.cast.framework;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
import com.google.android.gms.cast.framework.media.CastMediaOptions;
import com.google.android.gms.cast.LaunchOptions;
import java.util.ArrayList;
import java.util.List;
public class CastOptions extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
private String receiverApplicationId;
@SafeParceled(3)
private ArrayList<String> supportedNamespaces;
@SafeParceled(4)
private boolean stopReceiverApplicationWhenEndingSession;
@SafeParceled(5)
private LaunchOptions launchOptions;
@SafeParceled(6)
private boolean resumeSavedSession;
@SafeParceled(7)
private CastMediaOptions castMediaOptions;
@SafeParceled(8)
private boolean enableReconnectionService;
@SafeParceled(9)
private double volumeDeltaBeforeIceCreamSandwich;
public String getReceiverApplicationId() {
return this.receiverApplicationId;
}
public LaunchOptions getLaunchOptions() {
return this.launchOptions;
}
public static Creator<CastOptions> CREATOR = new AutoCreator<CastOptions>(CastOptions.class);
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.google.android.gms.cast.framework;
public final class CastState {
public static final int NO_DEVICES_AVAILABLE = 1;
public static final int NOT_CONNECTED = 2;
public static final int CONNECTING = 3;
public static final int CONNECTED = 4;
public static String toString(int castState) {
switch (castState) {
case NO_DEVICES_AVAILABLE:
return "NO_DEVICES_AVAILABLE";
case NOT_CONNECTED:
return "NOT_CONNECTED";
case CONNECTING:
return "CONNECTING";
case CONNECTED:
return "CONNECTED";
default:
return "UNKNOWN";
}
}
}

View File

@ -17,9 +17,20 @@
package com.google.android.gms.cast.framework.media;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class CastMediaOptions extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public String mediaIntentReceiverClassName;
@SafeParceled(3)
public String expandedControllerActivityClassName;
@SafeParceled(4)
public IImagePicker imagePicker;
@SafeParceled(5)
public NotificationOptions notificationOptions;
public static Creator<CastMediaOptions> CREATOR = new AutoCreator<CastMediaOptions>(CastMediaOptions.class);
}

View File

@ -0,0 +1,96 @@
/*
* Copyright (C) 2013-2017 microG Project Team
*
* 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.google.android.gms.cast.framework.media;
import java.util.List;
import com.google.android.gms.cast.framework.media.INotificationActionsProvider;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
public class NotificationOptions extends AutoSafeParcelable {
@SafeParceled(1)
private int versionCode = 1;
@SafeParceled(2)
public List<String> actions;
@SafeParceled(3)
public int[] compatActionIndices;
@SafeParceled(4)
public long skipStepMs;
@SafeParceled(5)
public String targetActivityClassName;
@SafeParceled(6)
public int getSmallIconDrawableResId;
@SafeParceled(7)
public int getStopLiveStreamDrawableResId;
@SafeParceled(8)
public int getPauseDrawableResId;
@SafeParceled(9)
public int getPlayDrawableResId;
@SafeParceled(10)
public int getSkipNextDrawableResId;
@SafeParceled(11)
public int getSkipPrevDrawableResId;
@SafeParceled(12)
public int getForwardDrawableResId;
@SafeParceled(13)
public int getForward10DrawableResId;
@SafeParceled(14)
public int getForward30DrawableResId;
@SafeParceled(15)
public int getRewindDrawableResId;
@SafeParceled(16)
public int getRewind10DrawableResId;
@SafeParceled(17)
public int getRewind30DrawableResId;
@SafeParceled(18)
public int getDisconnectDrawableResId;
@SafeParceled(19)
public int intvar19;
@SafeParceled(20)
public int getCastingToDeviceStringResId;
@SafeParceled(21)
public int getStopLiveStreamTitleResId;
@SafeParceled(22)
public int intvar22;
@SafeParceled(23)
public int intvar23;
@SafeParceled(24)
public int intvar24;
@SafeParceled(25)
public int intvar25;
@SafeParceled(26)
public int intvar26;
@SafeParceled(27)
public int intvar27;
@SafeParceled(28)
public int intvar28;
@SafeParceled(29)
public int intvar29;
@SafeParceled(30)
public int intvar30;
@SafeParceled(31)
public int intvar31;
@SafeParceled(32)
public int intvar32;
@SafeParceled(33)
public INotificationActionsProvider notificationActionsProvider;
public static Creator<NotificationOptions> CREATOR = new AutoCreator<NotificationOptions>(NotificationOptions.class);
}