mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-12-13 06:07:44 +01:00
Update Cast API
This commit is contained in:
parent
607fb4ae5f
commit
bb4037017c
@ -33,29 +33,57 @@ import java.util.List;
|
||||
public class CastDevice extends AutoSafeParcelable {
|
||||
private static final String EXTRA_CAST_DEVICE = "com.google.android.gms.cast.EXTRA_CAST_DEVICE";
|
||||
|
||||
/**
|
||||
* Video-output device capability.
|
||||
*/
|
||||
public static final int CAPABILITY_VIDEO_OUT = 1;
|
||||
|
||||
/**
|
||||
* Video-input device capability.
|
||||
*/
|
||||
public static final int CAPABILITY_VIDEO_IN = 2;
|
||||
|
||||
/**
|
||||
* Audio-output device capability.
|
||||
*/
|
||||
public static final int CAPABILITY_AUDIO_OUT = 4;
|
||||
|
||||
/**
|
||||
* Audio-input device capability.
|
||||
*/
|
||||
public static final int CAPABILITY_AUDIO_IN = 8;
|
||||
|
||||
@SafeParceled(1)
|
||||
private int versionCode;
|
||||
private int versionCode = 3;
|
||||
|
||||
@SafeParceled(2)
|
||||
private String deviceId;
|
||||
|
||||
@SafeParceled(3)
|
||||
private String addrString;
|
||||
private Inet4Address addr;
|
||||
|
||||
private String deviceId;
|
||||
|
||||
private String deviceVersion;
|
||||
|
||||
@SafeParceled(4)
|
||||
private String friendlyName;
|
||||
|
||||
@SafeParceled(5)
|
||||
private String modelName;
|
||||
|
||||
@SafeParceled(6)
|
||||
private String deviceVersion;
|
||||
|
||||
@SafeParceled(7)
|
||||
private int servicePort;
|
||||
|
||||
@SafeParceled(value = 8, subClass = WebImage.class)
|
||||
private ArrayList<WebImage> icons;
|
||||
|
||||
@SafeParceled(8)
|
||||
private int capabilities;
|
||||
|
||||
@SafeParceled(9)
|
||||
private int status;
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
@ -89,7 +117,7 @@ public class CastDevice extends AutoSafeParcelable {
|
||||
}
|
||||
|
||||
public String getModelName() {
|
||||
return null;
|
||||
return modelName;
|
||||
}
|
||||
|
||||
public int getServicePort() {
|
||||
@ -101,7 +129,7 @@ public class CastDevice extends AutoSafeParcelable {
|
||||
}
|
||||
|
||||
public boolean hasCapability(int capability) {
|
||||
return false;
|
||||
return (capability & capabilities) == capability;
|
||||
}
|
||||
|
||||
public boolean hasIcons() {
|
||||
|
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright 2013-2015 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 android.text.TextUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Intent constants for use with the Cast MediaRouteProvider. This class also contains utility methods for creating
|
||||
* a control category for discovering Cast media routes that support a specific app and/or set of namespaces, to be
|
||||
* used with MediaRouteSelector.
|
||||
*/
|
||||
public final class CastMediaControlIntent {
|
||||
@Deprecated
|
||||
public static final String CATEGORY_CAST = "com.google.android.gms.cast.CATEGORY_CAST";
|
||||
public static final String ACTION_SYNC_STATUS = "com.google.android.gms.cast.ACTION_SYNC_STATUS";
|
||||
|
||||
/**
|
||||
* The application ID for the Cast Default Media Receiver.
|
||||
*/
|
||||
public static final String DEFAULT_MEDIA_RECEIVER_APPLICATION_ID = "CC1AD845";
|
||||
|
||||
/**
|
||||
* An error code indicating that a Cast request has failed.
|
||||
*/
|
||||
public static final int ERROR_CODE_REQUEST_FAILED = 1;
|
||||
|
||||
/**
|
||||
* An error code indicating that the request could not be processed because the session could not be started.
|
||||
*/
|
||||
public static final int ERROR_CODE_SESSION_START_FAILED = 2;
|
||||
|
||||
/**
|
||||
* An error code indicating that the connection to the Cast device has been lost, but the system is actively
|
||||
* trying to re-establish the connection.
|
||||
*/
|
||||
public static final int ERROR_CODE_TEMPORARILY_DISCONNECTED = 3;
|
||||
|
||||
/**
|
||||
* The extra that contains the ID of the application to launch for an
|
||||
* {@link android.support.v7.media.MediaContolIntent#ACTION_START_SESSION} request.
|
||||
* The value is expected to be a String.
|
||||
*/
|
||||
public static final String EXTRA_CAST_APPLICATION_ID = "com.google.android.gms.cast.EXTRA_CAST_APPLICATION_ID";
|
||||
public static final String EXTRA_CAST_RELAUNCH_APPLICATION = "com.google.android.gms.cast.EXTRA_CAST_RELAUNCH_APPLICATION";
|
||||
public static final String EXTRA_CAST_LANGUAGE_CODE = "com.google.android.gms.cast.EXTRA_CAST_LANGUAGE_CODE";
|
||||
public static final String EXTRA_CAST_STOP_APPLICATION_WHEN_SESSION_ENDS = "com.google.android.gms.cast.EXTRA_CAST_STOP_APPLICATION_WHEN_SESSION_ENDS";
|
||||
public static final String EXTRA_CUSTOM_DATA = "com.google.android.gms.cast.EXTRA_CUSTOM_DATA";
|
||||
|
||||
/**
|
||||
* The extra that indicates whether debug logging should be enabled for the Cast session. The value is expected to be a boolean.
|
||||
*/
|
||||
public static final String EXTRA_DEBUG_LOGGING_ENABLED = "com.google.android.gms.cast.EXTRA_DEBUG_LOGGING_ENABLED";
|
||||
|
||||
/**
|
||||
* n error bundle extra for the error code. The value is an integer, and will be one of the {@code ERROR_CODE_*}
|
||||
* constants declared in this class.
|
||||
*/
|
||||
public static final String EXTRA_ERROR_CODE = "com.google.android.gms.cast.EXTRA_ERROR_CODE";
|
||||
|
||||
private static final String CATEGORY_CAST_REMOTE_PLAYBACK = "com.google.android.gms.cast.CATEGORY_CAST_REMOTE_PLAYBACK";
|
||||
|
||||
private CastMediaControlIntent() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a custom control category for discovering Cast devices that support running the specified app, independent of whether the app is running or not.
|
||||
*
|
||||
* @param applicationId The application ID of the receiver application.
|
||||
*/
|
||||
public static String categoryForCast(String applicationId) {
|
||||
return CATEGORY_CAST + "/" + applicationId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a custom control category for discovering Cast devices meeting both application ID and namespace
|
||||
* restrictions. See {@link #categoryForCast(Collection)} and {@link #categoryForCast(String)} for more details.
|
||||
*/
|
||||
public static String categoryForCast(String applicationId, Collection<String> namespaces) {
|
||||
return CATEGORY_CAST + "" + applicationId + "/" + TextUtils.join(",", namespaces);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a custom control category for discovering Cast devices currently running an application which supports the specified namespaces. Apps supporting additional namespaces beyond those specified here are still considered supported.
|
||||
*/
|
||||
public static String categoryForCast(Collection<String> namespaces) {
|
||||
return CATEGORY_CAST + "//" + TextUtils.join(",", namespaces);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a custom control category for discovering Cast devices which support the default Android remote
|
||||
* playback actions using the specified Cast player. If the Default Media Receiver is desired, use
|
||||
* {@link #DEFAULT_MEDIA_RECEIVER_APPLICATION_ID} as the applicationId.
|
||||
*
|
||||
* @param applicationId The application ID of the receiver application.
|
||||
*/
|
||||
public static String categoryForRemotePlayback(String applicationId) {
|
||||
return CATEGORY_CAST_REMOTE_PLAYBACK + "/" + applicationId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a custom control category for discovering Cast devices which support the Default Media Receiver.
|
||||
*/
|
||||
public static String categoryForRemotePlayback() {
|
||||
return CATEGORY_CAST_REMOTE_PLAYBACK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an RFC-5646 language tag string fo the given locale.
|
||||
*/
|
||||
public static String languageTagForLocale(Locale locale) {
|
||||
StringBuilder sb = new StringBuilder(locale.getLanguage());
|
||||
if (!TextUtils.isEmpty(locale.getCountry())) sb.append('-').append(locale.getCountry());
|
||||
if (!TextUtils.isEmpty(locale.getVariant())) sb.append('-').append(locale.getVariant());
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2013-2015 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;
|
||||
|
||||
public final class CastStatusCodes {
|
||||
public static final int APPLICATION_NOT_FOUND = 2004;
|
||||
public static final int APPLICATION_NOT_RUNNING = 2005;
|
||||
public static final int AUTHENTICATION_FAILED = 2000;
|
||||
public static final int CANCELED = 2002;
|
||||
public static final int ERROR_SERVICE_CREATION_FAILED = 2200;
|
||||
public static final int ERROR_SERVICE_DISCONNECTED = 2201;
|
||||
public static final int FAILED = 2100;
|
||||
public static final int INTERNAL_ERROR = 8;
|
||||
public static final int INTERRUPTED = 14;
|
||||
public static final int INVALID_REQUEST = 2001;
|
||||
public static final int MESSAGE_SEND_BUFFER_TOO_FULL = 2007;
|
||||
public static final int MESSAGE_TOO_LARGE = 2006;
|
||||
public static final int NETWORK_ERROR = 7;
|
||||
public static final int NOT_ALLOWED = 2003;
|
||||
public static final int REPLACED = 2103;
|
||||
public static final int SUCCESS = 0;
|
||||
public static final int TIMEOUT = 15;
|
||||
public static final int UNKNOWN_ERROR = 13;
|
||||
}
|
Loading…
Reference in New Issue
Block a user