Exploit database

GH-251dcce247d7af3061bf0e2fcb6e6714

trinadh465/packages_apps_bluetooth_aosp10_r33_cve-2022-20126

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2022-20126

2 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files16

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

src/com/android/bluetooth/hfp/HeadsetAgIndicatorEnableState.java

Java · 2,243 bytes
/*
 * Copyright 2018 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.bluetooth.hfp;

/**
 * An object that represents AG indicator enable states
 */
public class HeadsetAgIndicatorEnableState extends HeadsetMessageObject {
    public boolean service;
    public boolean roam;
    public boolean signal;
    public boolean battery;

    HeadsetAgIndicatorEnableState(boolean newService, boolean newRoam, boolean newSignal,
            boolean newBattery) {
        service = newService;
        roam = newRoam;
        signal = newSignal;
        battery = newBattery;
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof HeadsetAgIndicatorEnableState)) {
            return false;
        }
        HeadsetAgIndicatorEnableState other = (HeadsetAgIndicatorEnableState) obj;
        return service == other.service && roam == other.roam && signal == other.signal
                && battery == other.battery;
    }

    @Override
    public int hashCode() {
        int result = 0;
        if (service) result += 1;
        if (roam) result += 2;
        if (signal) result += 4;
        if (battery) result += 8;
        return result;
    }

    @Override
    public void buildString(StringBuilder builder) {
        if (builder == null) {
            return;
        }
        builder.append(this.getClass().getSimpleName())
                .append("[service=")
                .append(service)
                .append(", roam=")
                .append(roam)
                .append(", signal=")
                .append(signal)
                .append(", battery=")
                .append(battery)
                .append("]");
    }
}