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

Commit a762b520 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11840485 from 04c4364e to 24Q3-release

Change-Id: Ieb8afd3afbbda73140684586b93b1d1b0ed979e2
parents f77540ee 04c4364e
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -34,6 +34,24 @@ license {
    ],
}

aidl_interface_defaults {
    name: "audio-aidl-defaults",
    unstable: true,
    host_supported: true,
    backend: {
        cpp: {
            enabled: true,
        },
        java: {
            enabled: true,
        },
        rust: {
            enabled: true,
        },
    },

}

aidl_interface {
    name: "av-types-aidl",
    unstable: true,
@@ -71,6 +89,18 @@ aidl_interface {
    },
}

aidl_interface {
    name: "audio-permission-aidl",
    // TODO remove
    vendor_available: true,
    double_loadable: true,
    defaults: ["audio-aidl-defaults"],
    local_include_dir: "aidl",
    srcs: [
        "aidl/com/android/media/permission/*",
    ],
}

cc_library_headers {
    name: "av-headers",
    export_include_dirs: ["include"],
+36 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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 com.android.media.permission;

import com.android.media.permission.UidPackageState;

/**
 * This interface is used by system_server to communicate permission information
 * downwards towards native services.
 * {@hide}
 */
interface INativePermissionController {
    /**
     * Initialize app-ids and their corresponding packages, to be used for package validation.
     */
    void populatePackagesForUids(in List<UidPackageState> initialPackageStates);
    /**
     * Replace or populate the list of packages associated with a given uid.
     * If the list is empty, the package no longer exists.
     */
    void updatePackagesForUid(in UidPackageState newPackageState);
}
+26 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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 com.android.media.permission;

/**
 * Entity representing the package names associated with a particular uid/app-id
 * {@hide}
 */
parcelable UidPackageState {
    int uid;
    @utf8InCpp List<String> packageNames;
}
+42 −2
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ void GraphicsTracker::BufferCache::unblockSlot(int slot) {
}

GraphicsTracker::GraphicsTracker(int maxDequeueCount)
    : mBufferCache(new BufferCache()), mMaxDequeue{maxDequeueCount},
    : mBufferCache(new BufferCache()), mNumDequeueing{0}, mMaxDequeue{maxDequeueCount},
    mMaxDequeueCommitted{maxDequeueCount},
    mDequeueable{maxDequeueCount},
    mTotalDequeued{0}, mTotalCancelled{0}, mTotalDropped{0}, mTotalReleased{0},
@@ -235,6 +235,7 @@ c2_status_t GraphicsTracker::configureGraphics(
        const sp<IGraphicBufferProducer>& igbp, uint32_t generation) {
    // TODO: wait until operations to previous IGBP is completed.
    std::shared_ptr<BufferCache> prevCache;
    int prevDequeueRequested = 0;
    int prevDequeueCommitted;

    std::unique_lock<std::mutex> cl(mConfigLock);
@@ -243,6 +244,9 @@ c2_status_t GraphicsTracker::configureGraphics(
        mInConfig = true;
        prevCache = mBufferCache;
        prevDequeueCommitted = mMaxDequeueCommitted;
        if (mMaxDequeueRequested.has_value()) {
            prevDequeueRequested = mMaxDequeueRequested.value();
        }
    }
    // NOTE: Switching to the same surface is blocked from MediaCodec.
    // Switching to the same surface might not work if tried, since disconnect()
@@ -263,6 +267,11 @@ c2_status_t GraphicsTracker::configureGraphics(
        mInConfig = false;
        return C2_BAD_VALUE;
    }
    ALOGD("new surface in configuration: maxDequeueRequested(%d), maxDequeueCommitted(%d)",
          prevDequeueRequested, prevDequeueCommitted);
    if (prevDequeueRequested > 0 && prevDequeueRequested > prevDequeueCommitted) {
        prevDequeueCommitted = prevDequeueRequested;
    }
    if (igbp) {
        ret = igbp->setMaxDequeuedBufferCount(prevDequeueCommitted);
        if (ret != ::android::OK) {
@@ -280,6 +289,34 @@ c2_status_t GraphicsTracker::configureGraphics(
        std::unique_lock<std::mutex> l(mLock);
        mInConfig = false;
        mBufferCache = newCache;
        // {@code dequeued} is the number of currently dequeued buffers.
        // {@code prevDequeueCommitted} is max dequeued buffer at any moment
        //  from the new surface.
        // {@code newDequeueable} is hence the current # of dequeueable buffers
        //  if no change occurs.
        int dequeued = mDequeued.size() + mNumDequeueing;
        int newDequeueable = prevDequeueCommitted - dequeued;
        if (newDequeueable < 0) {
            // This will not happen.
            // But if this happens, we respect the value and try to continue.
            ALOGE("calculated new dequeueable is negative: %d max(%d),dequeued(%d)",
                  newDequeueable, prevDequeueCommitted, dequeued);
        }

        if (mMaxDequeueRequested.has_value() && mMaxDequeueRequested == prevDequeueCommitted) {
            mMaxDequeueRequested.reset();
        }
        mMaxDequeue = mMaxDequeueCommitted = prevDequeueCommitted;

        int delta = newDequeueable - mDequeueable;
        if (delta > 0) {
            writeIncDequeueableLocked(delta);
        } else if (delta < 0) {
            drainDequeueableLocked(-delta);
        }
        ALOGV("new surfcace dequeueable %d(delta %d), maxDequeue %d",
              newDequeueable, delta, mMaxDequeue);
        mDequeueable = newDequeueable;
    }
    return C2_OK;
}
@@ -529,6 +566,7 @@ c2_status_t GraphicsTracker::requestAllocate(std::shared_ptr<BufferCache> *cache
            ALOGE("writing end for the waitable object seems to be closed");
            return C2_BAD_STATE;
        }
        mNumDequeueing++;
        mDequeueable--;
        *cache = mBufferCache;
        return C2_OK;
@@ -543,6 +581,7 @@ void GraphicsTracker::commitAllocate(c2_status_t res, const std::shared_ptr<Buff
                    bool cached, int slot, const sp<Fence> &fence,
                    std::shared_ptr<BufferItem> *pBuffer, bool *updateDequeue) {
    std::unique_lock<std::mutex> l(mLock);
    mNumDequeueing--;
    if (res == C2_OK) {
        if (cached) {
            auto it = cache->mBuffers.find(slot);
@@ -655,7 +694,8 @@ c2_status_t GraphicsTracker::_allocate(const std::shared_ptr<BufferCache> &cache
            ALOGE("allocate by dequeueBuffer() successful, but requestBuffer() failed %d",
                  status);
            igbp->cancelBuffer(slotId, fence);
            return C2_CORRUPTED;
            // This might be due to life-cycle end and/or surface switching.
            return C2_BLOCKING;
        }
        *buffer = std::make_shared<BufferItem>(generation, slotId, realloced, fence);
        if (!*buffer) {
+1 −0
Original line number Diff line number Diff line
@@ -234,6 +234,7 @@ private:
    // Maps bufferId to buffer
    std::map<uint64_t, std::shared_ptr<BufferItem>> mDequeued;
    std::set<uint64_t> mDeallocating;
    int mNumDequeueing;

    // These member variables are read and modified accessed as follows.
    // 1. mConfigLock being held
Loading