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

Commit de6f60a9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use changeID and Compatibility.isChangeEnabled for Mainline"

parents 1dad0a01 d0c81812
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -20,6 +20,9 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.compat.Compatibility;
import android.compat.annotation.ChangeId;
import android.compat.annotation.EnabledAfter;
import android.compat.annotation.UnsupportedAppUsage;
import android.net.LinkProperties;
import android.os.Build;
@@ -31,8 +34,6 @@ import android.telephony.Annotation.DataState;
import android.telephony.Annotation.NetworkType;
import android.telephony.data.ApnSetting;

import dalvik.system.VMRuntime;

import java.util.Objects;


@@ -133,6 +134,13 @@ public final class PreciseDataConnectionState implements Parcelable {
        mApnSetting = (ApnSetting) in.readParcelable(null);
    }

    /**
     * To check the SDK version for {@link PreciseDataConnectionState#getDataConnectionState}.
     */
    @ChangeId
    @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.R)
    private static final long GET_DATA_CONNECTION_STATE_CODE_CHANGE = 147600208L;

    /**
     * Returns the state of data connection that supported the apn types returned by
     * {@link #getDataConnectionApnTypeBitMask()}
@@ -144,7 +152,7 @@ public final class PreciseDataConnectionState implements Parcelable {
    @SystemApi
    public @DataState int getDataConnectionState() {
        if (mState == TelephonyManager.DATA_DISCONNECTING
                && VMRuntime.getRuntime().getTargetSdkVersion() < Build.VERSION_CODES.R) {
                && !Compatibility.isChangeEnabled(GET_DATA_CONNECTION_STATE_CODE_CHANGE)) {
            return TelephonyManager.DATA_CONNECTED;
        }

+16 −4
Original line number Diff line number Diff line
@@ -113,8 +113,6 @@ import com.android.internal.telephony.RILConstants;
import com.android.internal.telephony.SmsApplication;
import com.android.telephony.Rlog;

import dalvik.system.VMRuntime;

import java.io.FileInputStream;
import java.io.IOException;
import java.lang.annotation.Retention;
@@ -5416,6 +5414,13 @@ public class TelephonyManager {
     */
    public static final int DATA_DISCONNECTING = 4;

    /**
     * To check the SDK version for {@link TelephonyManager#getDataState}.
     */
    @ChangeId
    @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.R)
    private static final long GET_DATA_STATE_CODE_CHANGE = 147600208L;

    /**
     * Returns a constant indicating the current data connection state
     * (cellular).
@@ -5434,7 +5439,7 @@ public class TelephonyManager {
            int state = telephony.getDataStateForSubId(
                    getSubId(SubscriptionManager.getActiveDataSubscriptionId()));
            if (state == TelephonyManager.DATA_DISCONNECTING
                    && VMRuntime.getRuntime().getTargetSdkVersion() < Build.VERSION_CODES.R) {
                    && !Compatibility.isChangeEnabled(GET_DATA_STATE_CODE_CHANGE)) {
                return TelephonyManager.DATA_CONNECTED;
            }

@@ -5495,6 +5500,13 @@ public class TelephonyManager {
    //
    //

    /**
     * To check the SDK version for {@link TelephonyManager#listen}.
     */
    @ChangeId
    @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.Q)
    private static final long LISTEN_CODE_CHANGE = 147600208L;

    /**
     * Registers a listener object to receive notification of changes
     * in specified telephony states.
@@ -5534,7 +5546,7 @@ public class TelephonyManager {
                // subId from PhoneStateListener is deprecated Q on forward, use the subId from
                // TelephonyManager instance. keep using subId from PhoneStateListener for pre-Q.
                int subId = mSubId;
                if (VMRuntime.getRuntime().getTargetSdkVersion() >= Build.VERSION_CODES.Q) {
                if (Compatibility.isChangeEnabled(LISTEN_CODE_CHANGE)) {
                    // since mSubId in PhoneStateListener is deprecated from Q on forward, this is
                    // the only place to set mSubId and its for "informational" only.
                    //  TODO: remove this once we completely get rid of mSubId in PhoneStateListener