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

Commit 8002ffa7 authored by Surbhi Kadam's avatar Surbhi Kadam Committed by Android (Google) Code Review
Browse files

Merge "Add token tracing for early wakeup request" into main

parents 69b87064 04f2bae7
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -89,12 +89,13 @@ cc_library_headers {
filegroup {
    name: "guiconstants_aidl",
    srcs: [
        "android/gui/BorderSettings.aidl",
        "android/gui/BoxShadowSettings.aidl",
        "android/gui/DropInputMode.aidl",
        "android/gui/EarlyWakeupInfo.aidl",
        "android/gui/StalledTransactionInfo.aidl",
        "android/**/TouchOcclusionMode.aidl",
        "android/gui/TrustedOverlay.aidl",
        "android/gui/BorderSettings.aidl",
        "android/gui/BoxShadowSettings.aidl",
    ],
}

+19 −2
Original line number Diff line number Diff line
@@ -66,7 +66,8 @@ public:
            InputWindowCommands commands, int64_t desiredPresentTime, bool isAutoTimestamp,
            const std::vector<client_cache_t>& uncacheBuffers, bool hasListenerCallbacks,
            const std::vector<ListenerCallbacks>& listenerCallbacks, uint64_t transactionId,
            const std::vector<uint64_t>& mergedTransactionIds) override {
            const std::vector<uint64_t>& mergedTransactionIds,
            const std::vector<gui::EarlyWakeupInfo>& earlyWakeupInfos) override {
        Parcel data, reply;
        data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());

@@ -107,6 +108,11 @@ public:
            SAFE_PARCEL(data.writeUint64, mergedTransactionId);
        }

        SAFE_PARCEL(data.writeUint32, static_cast<uint32_t>(earlyWakeupInfos.size()));
        for (const auto& e : earlyWakeupInfos) {
            e.writeToParcel(&data);
        }

        if (flags & ISurfaceComposer::eOneWay) {
            return remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE,
                    data, &reply, IBinder::FLAG_ONEWAY);
@@ -197,10 +203,21 @@ status_t BnSurfaceComposer::onTransact(
                SAFE_PARCEL(data.readUint64, &mergedTransactions[i]);
            }

            count = 0;
            SAFE_PARCEL_READ_SIZE(data.readUint32, &count, data.dataSize());
            std::vector<gui::EarlyWakeupInfo> earlyWakeupInfos;
            state.setCapacity(count);
            for (size_t i = 0; i < count; i++) {
                gui::EarlyWakeupInfo e;
                e.readFromParcel(&data);
                earlyWakeupInfos.push_back(std::move(e));
            }

            return setTransactionState(frameTimelineInfo, state, displays, stateFlags, applyToken,
                                       std::move(inputWindowCommands), desiredPresentTime,
                                       isAutoTimestamp, uncacheBuffers, hasListenerCallbacks,
                                       listenerCallbacks, transactionId, mergedTransactions);
                                       listenerCallbacks, transactionId, mergedTransactions,
                                       earlyWakeupInfos);
        }
        case GET_SCHEDULING_POLICY: {
            gui::SchedulingPolicy policy;
+38 −7
Original line number Diff line number Diff line
@@ -841,6 +841,7 @@ SurfaceComposerClient::Transaction::Transaction(const Transaction& other)
    mComposerStates = other.mComposerStates;
    mInputWindowCommands = other.mInputWindowCommands;
    mListenerCallbacks = other.mListenerCallbacks;
    mEarlyWakeupInfos = other.mEarlyWakeupInfos;
    mTransactionCompletedListener = TransactionCompletedListener::getInstance();
}

@@ -958,6 +959,17 @@ status_t SurfaceComposerClient::Transaction::readFromParcel(const Parcel* parcel
        SAFE_PARCEL(parcel->readUint64, &mergedTransactionIds[i]);
    }

    count = static_cast<size_t>(parcel->readUint32());
    if (count > parcel->dataSize()) {
        return BAD_VALUE;
    }
    std::vector<gui::EarlyWakeupInfo> earlyWakeupInfos;
    for (size_t i = 0; i < count; i++) {
        gui::EarlyWakeupInfo e;
        e.readFromParcel(parcel);
        earlyWakeupInfos.push_back(std::move(e));
    }

    // Parsing was successful. Update the object.
    mId = transactionId;
    mFlags = flags;
@@ -971,6 +983,7 @@ status_t SurfaceComposerClient::Transaction::readFromParcel(const Parcel* parcel
    mApplyToken = applyToken;
    mUncacheBuffers = std::move(uncacheBuffers);
    mMergedTransactionIds = std::move(mergedTransactionIds);
    mEarlyWakeupInfos = std::move(earlyWakeupInfos);
    return NO_ERROR;
}

@@ -1031,6 +1044,11 @@ status_t SurfaceComposerClient::Transaction::writeToParcel(Parcel* parcel) const
        SAFE_PARCEL(parcel->writeUint64, mergedTransactionId);
    }

    SAFE_PARCEL(parcel->writeUint32, static_cast<uint32_t>(mEarlyWakeupInfos.size()));
    for (auto earlyWakeupInfo : mEarlyWakeupInfos) {
        earlyWakeupInfo.writeToParcel(parcel);
    }

    return NO_ERROR;
}

@@ -1140,7 +1158,12 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::merge(Tr
             "Transaction %" PRIu64 " merged with transaction %" PRIu64, other.getId(), mId);
    }

    for (gui::EarlyWakeupInfo& op : other.mEarlyWakeupInfos) {
        mEarlyWakeupInfos.push_back(std::move(op));
    }

    other.clear();

    return *this;
}

@@ -1158,6 +1181,7 @@ void SurfaceComposerClient::Transaction::clear() {
    mMergedTransactionIds.clear();
    mLogCallPoints = false;
    mFlags = 0;
    mEarlyWakeupInfos.clear();
}

uint64_t SurfaceComposerClient::Transaction::getId() {
@@ -1176,10 +1200,11 @@ void SurfaceComposerClient::doUncacheBufferTransaction(uint64_t cacheId) {
    uncacheBuffer.id = cacheId;
    Vector<ComposerState> composerStates;
    Vector<DisplayState> displayStates;
    status_t status = sf->setTransactionState(FrameTimelineInfo{}, composerStates, displayStates,
                                              ISurfaceComposer::eOneWay,
                                              Transaction::getDefaultApplyToken(), {}, systemTime(),
                                              true, {uncacheBuffer}, false, {}, generateId(), {});
    status_t status =
            sf->setTransactionState(FrameTimelineInfo{}, composerStates, displayStates,
                                    ISurfaceComposer::eOneWay, Transaction::getDefaultApplyToken(),
                                    {}, systemTime(), true, {uncacheBuffer}, false, {},
                                    generateId(), {}, {});
    if (status != NO_ERROR) {
        ALOGE_AND_TRACE("SurfaceComposerClient::doUncacheBufferTransaction - %s",
                        strerror(-status));
@@ -1336,11 +1361,13 @@ status_t SurfaceComposerClient::Transaction::apply(bool synchronous, bool oneWay
    sp<IBinder> applyToken = mApplyToken ? mApplyToken : getDefaultApplyToken();

    sp<ISurfaceComposer> sf(ComposerService::getComposerService());

    status_t binderStatus =
            sf->setTransactionState(mFrameTimelineInfo, mComposerStates, mDisplayStates, mFlags,
                                    applyToken, mInputWindowCommands, mDesiredPresentTime,
                                    mIsAutoTimestamp, mUncacheBuffers, hasListenerCallbacks,
                                    listenerCallbacks, mId, mMergedTransactionIds);
                                    listenerCallbacks, mId, mMergedTransactionIds,
                                    mEarlyWakeupInfos);
    mId = generateId();

    // Clear the current states and flags
@@ -1447,11 +1474,15 @@ void SurfaceComposerClient::Transaction::setAnimationTransaction() {
    mFlags |= ISurfaceComposer::eAnimation;
}

void SurfaceComposerClient::Transaction::setEarlyWakeupStart() {
void SurfaceComposerClient::Transaction::setEarlyWakeupStart(gui::EarlyWakeupInfo earlyWakeupInfo) {
    earlyWakeupInfo.isStartRequest = true;
    mEarlyWakeupInfos.push_back(std::move(earlyWakeupInfo));
    mFlags |= ISurfaceComposer::eEarlyWakeupStart;
}

void SurfaceComposerClient::Transaction::setEarlyWakeupEnd() {
void SurfaceComposerClient::Transaction::setEarlyWakeupEnd(gui::EarlyWakeupInfo earlyWakeupInfo) {
    earlyWakeupInfo.isStartRequest = false;
    mEarlyWakeupInfos.push_back(std::move(earlyWakeupInfo));
    mFlags |= ISurfaceComposer::eEarlyWakeupEnd;
}

+26 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2025, 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;

import android.os.IBinder;

/** @hide */
parcelable EarlyWakeupInfo {
    @nullable IBinder token;
    @utf8InCpp String trace;
    boolean isStartRequest;
}
+3 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <android/gui/CachingHint.h>
#include <android/gui/DisplayBrightness.h>
#include <android/gui/DisplayCaptureArgs.h>
#include <android/gui/EarlyWakeupInfo.h>
#include <android/gui/FrameTimelineInfo.h>
#include <android/gui/IDisplayEventConnection.h>
#include <android/gui/IFpsListener.h>
@@ -111,7 +112,8 @@ public:
            InputWindowCommands inputWindowCommands, int64_t desiredPresentTime,
            bool isAutoTimestamp, const std::vector<client_cache_t>& uncacheBuffer,
            bool hasListenerCallbacks, const std::vector<ListenerCallbacks>& listenerCallbacks,
            uint64_t transactionId, const std::vector<uint64_t>& mergedTransactionIds) = 0;
            uint64_t transactionId, const std::vector<uint64_t>& mergedTransactionIds,
            const std::vector<gui::EarlyWakeupInfo>& earlyWakeupInfos) = 0;
};

// ----------------------------------------------------------------------------
Loading