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

Commit 1349f5c1 authored by David Su's avatar David Su
Browse files

Fix references to new S APIs without version checks

These new S APIs will throw UnsupportedOperationException
when running on an R device (even though it's called from
within the Wifi module!!!).

Add version checks before calling them.

Note that this is a temporary solution to unblock testing
S module on R base image. Will seek a better long term
solution.

Bug: 173791707
Test: S module on R base image boots and connects to wifi
Change-Id: I6b6920a0f948677767fa366f5db582ec799e08de
parent e4b731af
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -538,6 +538,15 @@ public final class SoftApConfiguration implements Parcelable {
        if (!SdkLevel.isAtLeastS()) {
            throw new UnsupportedOperationException();
        }
        return getChannelsInternal();
    }

    /**
     * Internal version bypassing SdkLevel checks
     * TODO(b/173791707): find a better way to allow Wifi to call its own new S APIs.
     * @hide
     */
    public @NonNull SparseIntArray getChannelsInternal() {
        return mChannels.clone();
    }

+9 −0
Original line number Diff line number Diff line
@@ -183,6 +183,15 @@ public final class SoftApInfo implements Parcelable {
        if (!SdkLevel.isAtLeastS()) {
            throw new UnsupportedOperationException();
        }
        return getWifiStandardInternal();
    }

    /**
     * Internal version bypassing SdkLevel checks
     * TODO(b/173791707): find a better way to allow Wifi to call its own new S APIs.
     * @hide
     */
    public @WifiAnnotations.WifiStandard int getWifiStandardInternal() {
        return mWifiStandard;
    }