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

Commit 097f4e86 authored by Galia Peycheva's avatar Galia Peycheva Committed by Automerger Merge Worker
Browse files

Add SF side tunnel mode listener am: 8f04b30c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/14340746

Change-Id: Iea330199408245cd058f2ee298af51ced9cce717
parents 87b87fa1 8f04b30c
Loading
Loading
Loading
Loading
+50 −0
Original line number Original line Diff line number Diff line
@@ -824,6 +824,36 @@ public:
        return error;
        return error;
    }
    }


    virtual status_t addTunnelModeEnabledListener(
            const sp<gui::ITunnelModeEnabledListener>& listener) {
        Parcel data, reply;
        SAFE_PARCEL(data.writeInterfaceToken, ISurfaceComposer::getInterfaceDescriptor());
        SAFE_PARCEL(data.writeStrongBinder, IInterface::asBinder(listener));

        const status_t error =
                remote()->transact(BnSurfaceComposer::ADD_TUNNEL_MODE_ENABLED_LISTENER, data,
                                   &reply);
        if (error != NO_ERROR) {
            ALOGE("addTunnelModeEnabledListener: Failed to transact");
        }
        return error;
    }

    virtual status_t removeTunnelModeEnabledListener(
            const sp<gui::ITunnelModeEnabledListener>& listener) {
        Parcel data, reply;
        SAFE_PARCEL(data.writeInterfaceToken, ISurfaceComposer::getInterfaceDescriptor());
        SAFE_PARCEL(data.writeStrongBinder, IInterface::asBinder(listener));

        const status_t error =
                remote()->transact(BnSurfaceComposer::REMOVE_TUNNEL_MODE_ENABLED_LISTENER, data,
                                   &reply);
        if (error != NO_ERROR) {
            ALOGE("removeTunnelModeEnabledListener: Failed to transact");
        }
        return error;
    }

    status_t setDesiredDisplayModeSpecs(const sp<IBinder>& displayToken,
    status_t setDesiredDisplayModeSpecs(const sp<IBinder>& displayToken,
                                        ui::DisplayModeId defaultMode, bool allowGroupSwitching,
                                        ui::DisplayModeId defaultMode, bool allowGroupSwitching,
                                        float primaryRefreshRateMin, float primaryRefreshRateMax,
                                        float primaryRefreshRateMin, float primaryRefreshRateMax,
@@ -1740,6 +1770,26 @@ status_t BnSurfaceComposer::onTransact(
            }
            }
            return removeFpsListener(listener);
            return removeFpsListener(listener);
        }
        }
        case ADD_TUNNEL_MODE_ENABLED_LISTENER: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            sp<gui::ITunnelModeEnabledListener> listener;
            status_t result = data.readNullableStrongBinder(&listener);
            if (result != NO_ERROR) {
                ALOGE("addTunnelModeEnabledListener: Failed to read listener");
                return result;
            }
            return addTunnelModeEnabledListener(listener);
        }
        case REMOVE_TUNNEL_MODE_ENABLED_LISTENER: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            sp<gui::ITunnelModeEnabledListener> listener;
            status_t result = data.readNullableStrongBinder(&listener);
            if (result != NO_ERROR) {
                ALOGE("removeTunnelModeEnabledListener: Failed to read listener");
                return result;
            }
            return removeTunnelModeEnabledListener(listener);
        }
        case SET_DESIRED_DISPLAY_MODE_SPECS: {
        case SET_DESIRED_DISPLAY_MODE_SPECS: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            sp<IBinder> displayToken = data.readStrongBinder();
            sp<IBinder> displayToken = data.readStrongBinder();
+10 −0
Original line number Original line Diff line number Diff line
@@ -2077,6 +2077,16 @@ status_t SurfaceComposerClient::removeFpsListener(const sp<gui::IFpsListener>& l
    return ComposerService::getComposerService()->removeFpsListener(listener);
    return ComposerService::getComposerService()->removeFpsListener(listener);
}
}


status_t SurfaceComposerClient::addTunnelModeEnabledListener(
        const sp<gui::ITunnelModeEnabledListener>& listener) {
    return ComposerService::getComposerService()->addTunnelModeEnabledListener(listener);
}

status_t SurfaceComposerClient::removeTunnelModeEnabledListener(
        const sp<gui::ITunnelModeEnabledListener>& listener) {
    return ComposerService::getComposerService()->removeTunnelModeEnabledListener(listener);
}

bool SurfaceComposerClient::getDisplayBrightnessSupport(const sp<IBinder>& displayToken) {
bool SurfaceComposerClient::getDisplayBrightnessSupport(const sp<IBinder>& displayToken) {
    bool support = false;
    bool support = false;
    ComposerService::getComposerService()->getDisplayBrightnessSupport(displayToken, &support);
    ComposerService::getComposerService()->getDisplayBrightnessSupport(displayToken, &support);
+29 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright 2021 The Android Open Source Project
 *
 * 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 android.gui;

/** @hide */
oneway interface ITunnelModeEnabledListener {

    /**
     * Called when tunnel mode status has changed. Tunnel mode is:
     *  - enabled when there is a sideband stream attached to one of the layers in
     *    surface flinger
     *  - disabled when there is no layer with a sideband stream
     */
    void onTunnelModeEnabledChanged(boolean enabled);
}
+18 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@
#include <android/gui/IHdrLayerInfoListener.h>
#include <android/gui/IHdrLayerInfoListener.h>
#include <android/gui/IScreenCaptureListener.h>
#include <android/gui/IScreenCaptureListener.h>
#include <android/gui/ITransactionTraceListener.h>
#include <android/gui/ITransactionTraceListener.h>
#include <android/gui/ITunnelModeEnabledListener.h>
#include <binder/IBinder.h>
#include <binder/IBinder.h>
#include <binder/IInterface.h>
#include <binder/IInterface.h>
#include <gui/FrameTimelineInfo.h>
#include <gui/FrameTimelineInfo.h>
@@ -377,6 +378,21 @@ public:
     */
     */
    virtual status_t removeFpsListener(const sp<gui::IFpsListener>& listener) = 0;
    virtual status_t removeFpsListener(const sp<gui::IFpsListener>& listener) = 0;


    /* Registers a listener to receive tunnel mode enabled updates from SurfaceFlinger.
     *
     * Requires ACCESS_SURFACE_FLINGER permission.
     */
    virtual status_t addTunnelModeEnabledListener(
            const sp<gui::ITunnelModeEnabledListener>& listener) = 0;

    /*
     * Removes a listener that was receiving tunnel mode enabled updates from SurfaceFlinger.
     *
     * Requires ACCESS_SURFACE_FLINGER permission.
     */
    virtual status_t removeTunnelModeEnabledListener(
            const sp<gui::ITunnelModeEnabledListener>& listener) = 0;

    /* Sets the refresh rate boundaries for the display.
    /* Sets the refresh rate boundaries for the display.
     *
     *
     * The primary refresh rate range represents display manager's general guidance on the display
     * The primary refresh rate range represents display manager's general guidance on the display
@@ -607,6 +623,8 @@ public:
        ADD_HDR_LAYER_INFO_LISTENER,
        ADD_HDR_LAYER_INFO_LISTENER,
        REMOVE_HDR_LAYER_INFO_LISTENER,
        REMOVE_HDR_LAYER_INFO_LISTENER,
        ON_PULL_ATOM,
        ON_PULL_ATOM,
        ADD_TUNNEL_MODE_ENABLED_LISTENER,
        REMOVE_TUNNEL_MODE_ENABLED_LISTENER,
        // Always append new enum to the end.
        // Always append new enum to the end.
    };
    };


+5 −0
Original line number Original line Diff line number Diff line
@@ -50,6 +50,7 @@ class HdrCapabilities;
class ISurfaceComposerClient;
class ISurfaceComposerClient;
class IGraphicBufferProducer;
class IGraphicBufferProducer;
class IRegionSamplingListener;
class IRegionSamplingListener;
class ITunnelModeEnabledListener;
class Region;
class Region;


struct SurfaceControlStats {
struct SurfaceControlStats {
@@ -610,6 +611,10 @@ public:
    static status_t removeRegionSamplingListener(const sp<IRegionSamplingListener>& listener);
    static status_t removeRegionSamplingListener(const sp<IRegionSamplingListener>& listener);
    static status_t addFpsListener(int32_t taskId, const sp<gui::IFpsListener>& listener);
    static status_t addFpsListener(int32_t taskId, const sp<gui::IFpsListener>& listener);
    static status_t removeFpsListener(const sp<gui::IFpsListener>& listener);
    static status_t removeFpsListener(const sp<gui::IFpsListener>& listener);
    static status_t addTunnelModeEnabledListener(
            const sp<gui::ITunnelModeEnabledListener>& listener);
    static status_t removeTunnelModeEnabledListener(
            const sp<gui::ITunnelModeEnabledListener>& listener);


private:
private:
    virtual void onFirstRef();
    virtual void onFirstRef();
Loading