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

Commit 0400f2c9 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6179498 from 20a6ee25 to rvc-release

Change-Id: I7ae356e0a21e90fe01eda5cd133761ce3d62a203
parents fa2c5b6a 20a6ee25
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -14,13 +14,12 @@
 * limitations under the License.
 */

#include "GLHelper.h"

#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>

#include <ui/DisplayInfo.h>
#include <gui/SurfaceComposerClient.h>

#include "GLHelper.h"
#include <ui/DisplayConfig.h>

namespace android {

@@ -228,15 +227,15 @@ bool GLHelper::computeWindowScale(uint32_t w, uint32_t h, float* scale) {
        return false;
    }

    DisplayInfo info;
    status_t err = mSurfaceComposerClient->getDisplayInfo(dpy, &info);
    DisplayConfig config;
    status_t err = mSurfaceComposerClient->getActiveDisplayConfig(dpy, &config);
    if (err != NO_ERROR) {
        fprintf(stderr, "SurfaceComposer::getDisplayInfo failed: %#x\n", err);
        fprintf(stderr, "SurfaceComposer::getActiveDisplayConfig failed: %#x\n", err);
        return false;
    }

    float scaleX = float(info.w) / float(w);
    float scaleY = float(info.h) / float(h);
    float scaleX = static_cast<float>(config.resolution.getWidth()) / w;
    float scaleY = static_cast<float>(config.resolution.getHeight()) / h;
    *scale = scaleX < scaleY ? scaleX : scaleY;

    return true;
+4 −1
Original line number Diff line number Diff line
@@ -20,11 +20,14 @@ cc_library {
        "-Wthread-safety",
        "-Werror",
    ],
    stl: "libc++_static",

    srcs: ["adbd_auth.cpp"],
    export_include_dirs: ["include"],

    version_script: "libadbd_auth.map.txt",
    stubs: {
        versions: ["1"],
        symbol_file: "libadbd_auth.map.txt",
    },

@@ -36,7 +39,7 @@ cc_library {
        }
    },

    shared_libs: [
    static_libs: [
        "libbase",
        "libcutils",
        "liblog",
+25 −0
Original line number Diff line number Diff line
cc_defaults {
    name: "fakeservicemanager_defaults",
    srcs: [
        "ServiceManager.cpp",
    ],

    shared_libs: [
        "libbinder",
        "libutils",
    ],
}

cc_library {
    name: "libfakeservicemanager",
    defaults: ["fakeservicemanager_defaults"],
}

cc_test_host {
    name: "fakeservicemanager_test",
    defaults: ["fakeservicemanager_defaults"],
    srcs: [
        "test_sm.cpp",
    ],
    static_libs: ["libgmock"],
}
+64 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.
 */

#include "ServiceManager.h"

namespace android {

ServiceManager::ServiceManager() {}

sp<IBinder> ServiceManager::getService( const String16& name) const {
    // Servicemanager is single-threaded and cannot block. This method exists for legacy reasons.
    return checkService(name);
}

sp<IBinder> ServiceManager::checkService( const String16& name) const {
    auto it = mNameToService.find(name);
    if (it == mNameToService.end()) {
        return nullptr;
    }
    return it->second;
}

status_t ServiceManager::addService(const String16& name, const sp<IBinder>& service,
                                bool /*allowIsolated*/,
                                int /*dumpsysFlags*/) {
    mNameToService[name] = service;
    return NO_ERROR;
}

Vector<String16> ServiceManager::listServices(int /*dumpsysFlags*/) {
    Vector<String16> services;
    for (auto const& [name, service] : mNameToService) {
        (void) service;
         services.push_back(name);
    }
  return services;
}

IBinder* ServiceManager::onAsBinder() {
    return nullptr;
}

sp<IBinder> ServiceManager::waitForService(const String16& name) {
    return checkService(name);
}

bool ServiceManager::isDeclared(const String16& name) {
    return mNameToService.find(name) != mNameToService.end();
}

}  // namespace android
+74 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.
 */

#pragma once

#include <binder/IServiceManager.h>

#include <map>

namespace android {

/**
 * A local host simple implementation of IServiceManager, that does not
 * communicate over binder.
*/
class ServiceManager : public IServiceManager {
public:
    ServiceManager();

    /**
     * Equivalent of checkService.
     */
    sp<IBinder> getService( const String16& name) const override;

    /**
     * Retrieve an existing service, non-blocking.
     */
    sp<IBinder> checkService( const String16& name) const override;

    /**
     * Register a service.
     */
    status_t addService(const String16& name, const sp<IBinder>& service,
                        bool allowIsolated = false,
                        int dumpsysFlags = DUMP_FLAG_PRIORITY_DEFAULT) override;

    /**
     * Return list of all existing services.
     */
    Vector<String16> listServices(int dumpsysFlags = 0) override;

    IBinder* onAsBinder() override;

    /**
     * Effectively no-oped in this implementation - equivalent to checkService.
     */
    sp<IBinder> waitForService(const String16& name) override;

    /**
     * Check if a service is declared (e.g. VINTF manifest).
     *
     * If this returns true, waitForService should always be able to return the
     * service.
     */
     bool isDeclared(const String16& name) override;

private:
    std::map<String16, sp<IBinder>> mNameToService;
};

}  // namespace android
Loading