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

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

Snap for 7519874 from 1d524385 to sc-release

Change-Id: I7929215895677ee17f24074231fca88fc482e8fc
parents 6e61d67d 1d524385
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -17,14 +17,19 @@
#pragma once

#include <android-base/logging.h>
#include <random>

namespace aidl::android::hardware::biometrics::fingerprint {

class FakeFingerprintEngine {
  public:
    FakeFingerprintEngine() : mRandom(std::mt19937::default_seed) {}

    void generateChallengeImpl(ISessionCallback* cb) {
        LOG(INFO) << "generateChallengeImpl";
        cb->onChallengeGenerated(0 /* challenge */);
        std::uniform_int_distribution<int64_t> dist;
        auto challenge = dist(mRandom);
        cb->onChallengeGenerated(challenge);
    }

    void revokeChallengeImpl(ISessionCallback* cb, int64_t challenge) {
@@ -32,8 +37,13 @@ class FakeFingerprintEngine {
        cb->onChallengeRevoked(challenge);
    }

    void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/) {
    void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat) {
        LOG(INFO) << "enrollImpl";
        // Do proper HAT verification in the real implementation.
        if (hat.mac.empty()) {
            cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */);
            return;
        }
        cb->onEnrollmentProgress(0 /* enrollmentId */, 0 /* remaining */);
    }

@@ -71,6 +81,8 @@ class FakeFingerprintEngine {
        LOG(INFO) << "resetLockoutImpl";
        cb->onLockoutCleared();
    }

    std::mt19937 mRandom;
};

}  // namespace aidl::android::hardware::biometrics::fingerprint
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi@1.0-service-
    interface android.hardware.wifi@1.2::IWifi default
    interface android.hardware.wifi@1.3::IWifi default
    interface android.hardware.wifi@1.4::IWifi default
    interface android.hardware.wifi@1.5::IWifi default
    oneshot
    disabled
    class hal
+20 −7
Original line number Diff line number Diff line
@@ -136,24 +136,25 @@ WifiApIface::getValidFrequenciesForBandInternal(V1_0::WifiBand band) {

WifiStatus WifiApIface::setMacAddressInternal(
    const std::array<uint8_t, 6>& mac) {
    bool status;
    // Support random MAC up to 2 interfaces
    if (instances_.size() == 2) {
        int rbyte = 1;
        for (auto const& intf : instances_) {
            std::array<uint8_t, 6> rmac = mac;
            // reverse the bits to avoid clision
            // reverse the bits to avoid collision
            rmac[rbyte] = 0xff - rmac[rbyte];
            status = iface_util_.lock()->setMacAddress(intf, rmac);
            if (!status) {
            if (!iface_util_.lock()->setMacAddress(intf, rmac)) {
                LOG(INFO) << "Failed to set random mac address on " << intf;
                return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
            }
            rbyte++;
        }
    } else {
        status = iface_util_.lock()->setMacAddress(ifname_, mac);
    }
    if (!status) {
    // It also needs to set mac address for bridged interface, otherwise the mac
    // address of bridged interface will be changed after one of instance
    // down.
    if (!iface_util_.lock()->setMacAddress(ifname_, mac)) {
        LOG(ERROR) << "Fail to config MAC for interface " << ifname_;
        return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
    }
    return createWifiStatus(WifiStatusCode::SUCCESS);
@@ -181,6 +182,18 @@ WifiStatus WifiApIface::resetToFactoryMacAddressInternal() {
                return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
            }
        }
        // It needs to set mac address for bridged interface, otherwise the mac
        // address of the bridged interface will be changed after one of the
        // instance down. Thus we are generating a random MAC address for the
        // bridged interface even if we got the request to reset the Factory
        // MAC. Since the bridged interface is an internal interface for the
        // operation of bpf and others networking operation.
        if (!iface_util_.lock()->setMacAddress(
                ifname_, iface_util_.lock()->createRandomMacAddress())) {
            LOG(ERROR) << "Fail to config MAC for bridged interface "
                       << ifname_;
            return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
        }
    } else {
        getMacResult = getFactoryMacAddressInternal(ifname_);
        LOG(DEBUG) << "Reset MAC to factory MAC on " << ifname_;
+2 −2
Original line number Diff line number Diff line
@@ -86,9 +86,9 @@ bool WifiIfaceUtil::setMacAddress(const std::string& iface_name,
        event_handlers.on_state_toggle_off_on(iface_name);
    }
    if (!success) {
        LOG(ERROR) << "SetMacAddress failed.";
        LOG(ERROR) << "SetMacAddress failed on " << iface_name;
    } else {
        LOG(DEBUG) << "SetMacAddress succeeded.";
        LOG(DEBUG) << "SetMacAddress succeeded on " << iface_name;
    }
    return success;
}
+2 −2
Original line number Diff line number Diff line
@@ -71,10 +71,10 @@ class WifiIfaceUtil {

    virtual bool removeIfaceFromBridge(const std::string& br_name,
                                       const std::string& if_name);
    // Get a random MAC address.
    virtual std::array<uint8_t, 6> createRandomMacAddress();

   private:
    std::array<uint8_t, 6> createRandomMacAddress();

    std::weak_ptr<wifi_system::InterfaceTool> iface_tool_;
    std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
    std::unique_ptr<std::array<uint8_t, 6>> random_mac_address_;