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

Commit 5385ba9e authored by Kai Shi's avatar Kai Shi Committed by Automerger Merge Worker
Browse files

Merge "Remove obsolete version of LinkCapacityEstimate" into sc-dev am: 2be0ac3b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/13925280

Change-Id: Ied3ee34afbfbfbd1a7e54ff5848804f74d363a1a
parents 63bb2937 2be0ac3b
Loading
Loading
Loading
Loading
+0 −100
Original line number Diff line number Diff line
/*
 * Copyright (C) 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.internal.telephony;

/**
 * Link Bandwidth Information from the Radio
 */
public class LinkCapacityEstimate {
    /** Any field that is not reported shall be set to INVALID */
    public static final int INVALID = -1;

    /** LCE is active; Deprecated in HAL 1.2 */
    public static final int STATUS_ACTIVE = 0;

    /** LCE is suspended; Deprecated in HAL 1.2 */
    public static final int STATUS_SUSPENDED = 1;

    /** Downlink radio link capacity in kbps. In case of a dual connected network,
     * this includes capacity of both primary and secondary */
    public final int downlinkCapacityKbps;

    /** Uplink radio link capacity; added in HAL 1.2. In case of a dual connected network,
     * this includes capacity of both primary and secondary */
    public final int uplinkCapacityKbps;

    /** Downlink radio link capacity of secondary network in kbps */
    public final int secondaryDownlinkCapacityKbps;

    /** Uplink radio link capacity of secondary network in kbps */
    public final int secondaryUplinkCapacityKbps;

    /** Confidence of the downlink estimate as a percentage [1, 100]; deprecated in HAL 1.2 */
    public final int confidence;

    /** Status of the LCE; deprecated in HAL 1.2 */
    public final int status; // either STATUS_ACTIVE, STATUS_SUSPENDED, or INVALID

    /** Constructor matching the estimate in Radio HAL v1.0 */
    public LinkCapacityEstimate(int downlinkCapacityKbps, int confidence, int status) {
        this.downlinkCapacityKbps = downlinkCapacityKbps;
        this.confidence = confidence;
        this.status = status;
        this.uplinkCapacityKbps = INVALID;
        this.secondaryDownlinkCapacityKbps = INVALID;
        this.secondaryUplinkCapacityKbps = INVALID;
    }

    /** Constructor matching the estimate in Radio HAL v1.2 */
    public LinkCapacityEstimate(int downlinkCapacityKbps, int uplinkCapacityKbps) {
        this.downlinkCapacityKbps = downlinkCapacityKbps;
        this.uplinkCapacityKbps = uplinkCapacityKbps;
        this.confidence = INVALID;
        this.status = INVALID;
        this.secondaryDownlinkCapacityKbps = INVALID;
        this.secondaryUplinkCapacityKbps = INVALID;
    }

    /** Constructor matching the estimate in Radio HAL v1.6 */
    public LinkCapacityEstimate(int downlinkCapacityKbps, int uplinkCapacityKbps,
            int secondaryDownlinkCapacityKbps, int secondaryUplinkCapacityKbps) {
        this.downlinkCapacityKbps = downlinkCapacityKbps;
        this.uplinkCapacityKbps = uplinkCapacityKbps;
        this.confidence = INVALID;
        this.status = INVALID;
        this.secondaryDownlinkCapacityKbps = secondaryDownlinkCapacityKbps;
        this.secondaryUplinkCapacityKbps = secondaryUplinkCapacityKbps;
    }

    @Override
    public String toString() {
        return new StringBuilder()
                .append("{downlinkCapacityKbps=")
                .append(downlinkCapacityKbps)
                .append(", uplinkCapacityKbps=")
                .append(uplinkCapacityKbps)
                .append(", confidence=")
                .append(confidence)
                .append(", status=")
                .append(status)
                .append("{secondaryDownlinkCapacityKbps=")
                .append(secondaryDownlinkCapacityKbps)
                .append(", secondaryUplinkCapacityKbps=")
                .append(secondaryUplinkCapacityKbps)
                .toString();
    }
}