Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c18bafa authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

Update Cast API

parent 41a6ee84
Loading
Loading
Loading
Loading
Compare 607fb4ae to bb403701
Original line number Diff line number Diff line
Subproject commit 607fb4ae5f7950223a957cd3b7d8406c8d019340
Subproject commit bb4037017c447d8129abf7c5cbaa73e527da5631
+4 −4
Original line number Diff line number Diff line
@@ -56,28 +56,28 @@ public final class Api<O extends Api.ApiOptions> {
         * Base interface for {@link ApiOptions} in {@link Api}s that have options.
         */
        @PublicApi
        public interface HasOptions extends ApiOptions {
        interface HasOptions extends ApiOptions {
        }

        /**
         * Base interface for {@link ApiOptions} that are not required, don't exist.
         */
        @PublicApi
        public interface NotRequiredOptions extends ApiOptions {
        interface NotRequiredOptions extends ApiOptions {
        }

        /**
         * {@link ApiOptions} implementation for {@link Api}s that do not take any options.
         */
        @PublicApi
        public final class NoOptions implements NotRequiredOptions {
        final class NoOptions implements NotRequiredOptions {
        }

        /**
         * Base interface for {@link ApiOptions} that are optional.
         */
        @PublicApi
        public interface Optional extends HasOptions, NotRequiredOptions {
        interface Optional extends HasOptions, NotRequiredOptions {
        }
    }

+43 −0
Original line number Diff line number Diff line
/*
 * 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 org.microg.gms.common;

import org.microg.gms.common.api.ApiConnection;

public class DummyApiConnection implements ApiConnection {
    private boolean connected = false;

    @Override
    public void connect() {
        connected = true;
    }

    @Override
    public void disconnect() {
        connected = false;
    }

    @Override
    public boolean isConnected() {
        return connected;
    }

    @Override
    public boolean isConnecting() {
        return false;
    }
}
+74 −4
Original line number Diff line number Diff line
@@ -16,18 +16,88 @@

package com.google.android.gms.cast;

import android.os.Bundle;

import com.google.android.gms.common.api.Api;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.PendingResult;
import com.google.android.gms.common.api.Result;
import com.google.android.gms.common.api.Status;

import org.microg.gms.cast.CastApiBuilder;
import org.microg.gms.cast.CastApiImpl;
import org.microg.gms.common.PublicApi;

import java.io.IOException;

public class Cast {
@PublicApi
public final class Cast {

    /**
     * A constant indicating that the Google Cast device is not the currently active video input.
     */
    public static final int ACTIVE_INPUT_STATE_NO = 0;

    /**
     * A constant indicating that it is not known (and/or not possible to know) whether the Google Cast device is
     * the currently active video input. Active input state can only be reported when the Google Cast device is
     * connected to a TV or AVR with CEC support.
     */
    public static final int ACTIVE_INPUT_STATE_UNKNOWN = -1;

    /**
     * A constant indicating that the Google Cast device is the currently active video input.
     */
    public static final int ACTIVE_INPUT_STATE_YES = 1;

    /**
     * A boolean extra for the connection hint bundle passed to
     * {@link GoogleApiClient.ConnectionCallbacks#onConnected(Bundle)} that indicates that the connection was
     * re-established, but the receiver application that was in use at the time of the connection loss is no longer
     * running on the receiver.
     */
    public static final String EXTRA_APP_NO_LONGER_RUNNING = "com.google.android.gms.cast.EXTRA_APP_NO_LONGER_RUNNING";

    /**
     * The maximum raw message length (in bytes) that is supported by a Cast channel.
     */
    public static final int MAX_MESSAGE_LENGTH = 65536;

    /**
     * The maximum length (in characters) of a namespace name.
     */
    public static final int MAX_NAMESPACE_LENGTH = 128;

    /**
     * A constant indicating that the Google Cast device is not currently in standby.
     */
    public static final int STANDBY_STATE_NO = 0;

    /**
     * A constant indicating that it is not known (and/or not possible to know) whether the Google Cast device is
     * currently in standby. Standby state can only be reported when the Google Cast device is connected to a TV or
     * AVR with CEC support.
     */
    public static final int STANDBY_STATE_UNKNOWN = -1;

    /**
     * A constant indicating that the Google Cast device is currently in standby.
     */
    public static final int STANDBY_STATE_YES = 1;

    public static final Api<CastOptions> API = new Api<CastOptions>(null); // TODO
    public static final Cast.CastApi CastApi = null; // TODO

    /**
     * Token to pass to {@link GoogleApiClient.Builder#addApi(Api)} to enable the Cast features.
     */
    public static final Api<CastOptions> API = new Api<CastOptions>(new CastApiBuilder());

    /**
     * An implementation of the CastApi interface. The interface is used to interact with a cast device.
     */
    public static final Cast.CastApi CastApi = new CastApiImpl();

    private Cast() {
    }

    public interface ApplicationConnectionResult extends Result {
        ApplicationMetadata getApplicationMetadata();
+0 −64
Original line number Diff line number Diff line
/*
 * 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 java.util.Collection;
import java.util.Locale;

public class CastMediaControlIntent {
    public static final String ACTION_SYNC_STATUS = "com.google.android.gms.cast.ACTION_SYNC_STATUS";
    @Deprecated
    public static final String CATEGORY_CAST = "com.google.android.gms.cast.CATEGORY_CAST";

    public static final String EXTRA_CAST_APPLICATION_ID = "com.google.android.gms.cast.EXTRA_CAST_APPLICATION_ID";
    public static final String EXTRA_CAST_LANGUAGE_CODE = "com.google.android.gms.cast.EXTRA_CAST_LANGUAGE_CODE";
    public static final String EXTRA_CAST_RELAUNCH_APPLICATION = "com.google.android.gms.cast.EXTRA_CAST_RELAUNCH_APPLICATION";
    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";
    public static final String EXTRA_DEBUG_LOGGING_ENABLED = "com.google.android.gms.cast.EXTRA_DEBUG_LOGGING_ENABLED";
    public static final String EXTRA_ERROR_CODE = "com.google.android.gms.cast.EXTRA_ERROR_CODE";

    public static final String DEFAULT_MEDIA_RECEIVER_APPLICATION_ID = "CC1AD845";

    public static final int ERROR_CODE_REQUEST_FAILED = 1;
    public static final int ERROR_CODE_SESSION_START_FAILED = 2;
    public static final int ERROR_CODE_TEMPORARILY_DISCONNECTED = 3;

    public static String categoryForCast(String applicationId) {
        return CATEGORY_CAST; // TODO
    }

    public static String categoryForCast(String applicationId, Collection<String> namespaces) {
        return CATEGORY_CAST; // TODO
    }

    public static String categoryForCast(Collection<String> namespaces) {
        return CATEGORY_CAST; // TODO
    }

    public static String categoryForRemotePlayback(String applicationId) {
        return CATEGORY_CAST; // TODO
    }

    public static String categoryForRemotePlayback() {
        return CATEGORY_CAST; // TODO
    }

    public static String languageTagForLocale(Locale locale) {
        return CATEGORY_CAST; // TODO
    }
}
Loading