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

Commit 9a2db083 authored by Yixiao Luo's avatar Yixiao Luo Committed by Gerrit Code Review
Browse files

Merge "Add API to register AttributionSource of TV App to TIS"

parents 0c67ec28 f2c597df
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -25917,6 +25917,7 @@ package android.media.tv {
    method @Nullable public android.media.tv.TvInputService.RecordingSession onCreateRecordingSession(@NonNull String, @NonNull String);
    method @Nullable public abstract android.media.tv.TvInputService.Session onCreateSession(@NonNull String);
    method @Nullable public android.media.tv.TvInputService.Session onCreateSession(@NonNull String, @NonNull String);
    method @Nullable public android.media.tv.TvInputService.Session onCreateSession(@NonNull String, @NonNull String, @NonNull android.content.AttributionSource);
    field public static final int PRIORITY_HINT_USE_CASE_TYPE_BACKGROUND = 100; // 0x64
    field public static final int PRIORITY_HINT_USE_CASE_TYPE_LIVE = 400; // 0x190
    field public static final int PRIORITY_HINT_USE_CASE_TYPE_PLAYBACK = 300; // 0x12c
@@ -26077,6 +26078,7 @@ package android.media.tv {
    method public String getSelectedTrack(int);
    method public java.util.List<android.media.tv.TvTrackInfo> getTracks(int);
    method public boolean onUnhandledInputEvent(android.view.InputEvent);
    method public void overrideTvAppAttributionSource(@NonNull android.content.AttributionSource);
    method public void reset();
    method public void selectTrack(int, String);
    method public void sendAppPrivateCommand(@NonNull String, android.os.Bundle);
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.media.tv;

import android.content.AttributionSource;
import android.content.ComponentName;
import android.content.Intent;
import android.graphics.Rect;
@@ -62,7 +63,7 @@ interface ITvInputManager {
    void addBlockedRating(in String rating, int userId);
    void removeBlockedRating(in String rating, int userId);

    void createSession(in ITvInputClient client, in String inputId, boolean isRecordingSession,
    void createSession(in ITvInputClient client, in String inputId, in AttributionSource tvAppAttributionSource, boolean isRecordingSession,
            int seq, int userId);
    void releaseSession(in IBinder sessionToken, int userId);
    int getClientPid(in String sessionId);
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.media.tv;

import android.content.AttributionSource;
import android.hardware.hdmi.HdmiDeviceInfo;
import android.media.tv.ITvInputServiceCallback;
import android.media.tv.ITvInputSessionCallback;
@@ -30,7 +31,7 @@ interface ITvInputService {
    oneway void registerCallback(in ITvInputServiceCallback callback);
    oneway void unregisterCallback(in ITvInputServiceCallback callback);
    oneway void createSession(in InputChannel channel, in ITvInputSessionCallback callback,
            in String inputId, in String sessionId);
            in String inputId, in String sessionId, in AttributionSource tvAppAttributionSource);
    oneway void createRecordingSession(in ITvInputSessionCallback callback, in String inputId,
            in String sessionId);
    List<String> getAvailableExtensionInterfaceNames();
+0 −1
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import android.view.InputChannel;
import android.view.InputEvent;
import android.view.InputEventReceiver;
import android.view.Surface;

import com.android.internal.os.HandlerCaller;
import com.android.internal.os.SomeArgs;

+14 −12
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.content.AttributionSource;
import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
@@ -53,9 +54,7 @@ import android.view.InputEventSender;
import android.view.KeyEvent;
import android.view.Surface;
import android.view.View;

import com.android.internal.util.Preconditions;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
@@ -1835,13 +1834,15 @@ public final class TvInputManager {
     * of the given TV input.
     *
     * @param inputId The ID of the TV input.
     * @param tvAppAttributionSource The Attribution Source of the TV App.
     * @param callback A callback used to receive the created session.
     * @param handler A {@link Handler} that the session creation will be delivered to.
     * @hide
     */
    public void createSession(@NonNull String inputId, @NonNull final SessionCallback callback,
            @NonNull Handler handler) {
        createSessionInternal(inputId, false, callback, handler);
    public void createSession(@NonNull String inputId,
            @NonNull AttributionSource tvAppAttributionSource,
            @NonNull final SessionCallback callback, @NonNull Handler handler) {
        createSessionInternal(inputId, tvAppAttributionSource, false, callback, handler);
    }

    /**
@@ -1866,7 +1867,7 @@ public final class TvInputManager {
     * @param useCase the use case type of the client.
     *        {@see TvInputService#PriorityHintUseCaseType}.
     * @param sessionId the unique id of the session owned by the client.
     *        {@see TvInputService#onCreateSession(String, String)}.
     *        {@see TvInputService#onCreateSession(String, String, AttributionSource)}.
     *
     * @return the use case priority value for the given use case type and the client's foreground
     *         or background status.
@@ -1917,11 +1918,11 @@ public final class TvInputManager {
     */
    public void createRecordingSession(@NonNull String inputId,
            @NonNull final SessionCallback callback, @NonNull Handler handler) {
        createSessionInternal(inputId, true, callback, handler);
        createSessionInternal(inputId, null, true, callback, handler);
    }

    private void createSessionInternal(String inputId, boolean isRecordingSession,
            SessionCallback callback, Handler handler) {
    private void createSessionInternal(String inputId, AttributionSource tvAppAttributionSource,
            boolean isRecordingSession, SessionCallback callback, Handler handler) {
        Preconditions.checkNotNull(inputId);
        Preconditions.checkNotNull(callback);
        Preconditions.checkNotNull(handler);
@@ -1930,7 +1931,8 @@ public final class TvInputManager {
            int seq = mNextSeq++;
            mSessionCallbackRecordMap.put(seq, record);
            try {
                mService.createSession(mClient, inputId, isRecordingSession, seq, mUserId);
                mService.createSession(
                        mClient, inputId, tvAppAttributionSource, isRecordingSession, seq, mUserId);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
@@ -2101,8 +2103,8 @@ public final class TvInputManager {
     * @param deviceId The device ID to acquire Hardware for.
     * @param info The TV input which will use the acquired Hardware.
     * @param tvInputSessionId a String returned to TIS when the session was created.
     *        {@see TvInputService#onCreateSession(String, String)}. If null, the client will be
     *        treated as a background app.
     *        {@see TvInputService#onCreateSession(String, String, AttributionSource)}. If null, the
     *        client will be treated as a background app.
     * @param priorityHint The use case of the client. {@see TvInputService#PriorityHintUseCaseType}
     * @param executor the executor on which the listener would be invoked.
     * @param callback A callback to receive updates on Hardware.
Loading