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

Commit 22eafd17 authored by Lucas Lin's avatar Lucas Lin Committed by android-build-merger
Browse files

Merge "Better notification to user when DNS-over-TLS is broken" am: 81852c84...

Merge "Better notification to user when DNS-over-TLS is broken" am: 81852c84 am: eb24608d am: a55366ff
am: 7038dfad

Change-Id: Iffbdc181d8249f26b3c370474583673aaa1c5032
parents a2bb72bc 7038dfad
Loading
Loading
Loading
Loading
+42 −2
Original line number Diff line number Diff line
@@ -57,6 +57,9 @@ public final class NetworkCapabilities implements Parcelable {
    private static final String TAG = "NetworkCapabilities";
    private static final int INVALID_UID = -1;

    // Set to true when private DNS is broken.
    private boolean mPrivateDnsBroken;

    /**
     * @hide
     */
@@ -86,6 +89,7 @@ public final class NetworkCapabilities implements Parcelable {
        mUids = null;
        mEstablishingVpnAppUid = INVALID_UID;
        mSSID = null;
        mPrivateDnsBroken = false;
    }

    /**
@@ -104,6 +108,7 @@ public final class NetworkCapabilities implements Parcelable {
        mEstablishingVpnAppUid = nc.mEstablishingVpnAppUid;
        mUnwantedNetworkCapabilities = nc.mUnwantedNetworkCapabilities;
        mSSID = nc.mSSID;
        mPrivateDnsBroken = nc.mPrivateDnsBroken;
    }

    /**
@@ -557,6 +562,9 @@ public final class NetworkCapabilities implements Parcelable {
        }
        if (mLinkUpBandwidthKbps != 0 || mLinkDownBandwidthKbps != 0) return "link bandwidth";
        if (hasSignalStrength()) return "signalStrength";
        if (isPrivateDnsBroken()) {
            return "privateDnsBroken";
        }
        return null;
    }

@@ -1443,7 +1451,8 @@ public final class NetworkCapabilities implements Parcelable {
                && equalsSpecifier(that)
                && equalsTransportInfo(that)
                && equalsUids(that)
                && equalsSSID(that));
                && equalsSSID(that)
                && equalsPrivateDnsBroken(that));
    }

    @Override
@@ -1460,7 +1469,8 @@ public final class NetworkCapabilities implements Parcelable {
                + (mSignalStrength * 29)
                + Objects.hashCode(mUids) * 31
                + Objects.hashCode(mSSID) * 37
                + Objects.hashCode(mTransportInfo) * 41;
                + Objects.hashCode(mTransportInfo) * 41
                + Objects.hashCode(mPrivateDnsBroken) * 43;
    }

    @Override
@@ -1479,6 +1489,7 @@ public final class NetworkCapabilities implements Parcelable {
        dest.writeInt(mSignalStrength);
        dest.writeArraySet(mUids);
        dest.writeString(mSSID);
        dest.writeBoolean(mPrivateDnsBroken);
    }

    public static final @android.annotation.NonNull Creator<NetworkCapabilities> CREATOR =
@@ -1498,6 +1509,7 @@ public final class NetworkCapabilities implements Parcelable {
                netCap.mUids = (ArraySet<UidRange>) in.readArraySet(
                        null /* ClassLoader, null for default */);
                netCap.mSSID = in.readString();
                netCap.mPrivateDnsBroken = in.readBoolean();
                return netCap;
            }
            @Override
@@ -1555,6 +1567,10 @@ public final class NetworkCapabilities implements Parcelable {
            sb.append(" SSID: ").append(mSSID);
        }

        if (mPrivateDnsBroken) {
            sb.append(" Private DNS is broken");
        }

        sb.append("]");
        return sb.toString();
    }
@@ -1706,4 +1722,28 @@ public final class NetworkCapabilities implements Parcelable {
    public boolean isMetered() {
        return !hasCapability(NET_CAPABILITY_NOT_METERED);
    }

    /**
     * Check if private dns is broken.
     *
     * @return {@code true} if {@code mPrivateDnsBroken} is set when private DNS is broken.
     * @hide
     */
    public boolean isPrivateDnsBroken() {
        return mPrivateDnsBroken;
    }

    /**
     * Set mPrivateDnsBroken to true when private dns is broken.
     *
     * @param broken the status of private DNS to be set.
     * @hide
     */
    public void setPrivateDnsBroken(boolean broken) {
        mPrivateDnsBroken = broken;
    }

    private boolean equalsPrivateDnsBroken(NetworkCapabilities nc) {
        return mPrivateDnsBroken == nc.mPrivateDnsBroken;
    }
}
+6 −0
Original line number Diff line number Diff line
@@ -77,6 +77,12 @@ public class NetworkMisc implements Parcelable {
     */
    public boolean skip464xlat;

    /**
     * Set to true if the PRIVATE_DNS_BROKEN notification has shown for this network.
     * Reset this bit when private DNS mode is changed from strict mode to opportunistic/off mode.
     */
    public boolean hasShownBroken;

    public NetworkMisc() {
    }

+9 −0
Original line number Diff line number Diff line
@@ -3440,6 +3440,15 @@
    <!-- A notification is shown when the user connects to a Wi-Fi network and the system detects that that network has no Internet access. This is the notification's message. -->
    <string name="wifi_no_internet_detailed">Tap for options</string>

    <!-- A notification is shown when the user connects to a mobile network without internet access. This is the notification's title. -->
    <string name="mobile_no_internet">Mobile network has no internet access</string>

    <!-- A notification is shown when the user connects to a non-mobile and non-wifi network without internet access. This is the notification's title. -->
    <string name="other_networks_no_internet">Network has no internet access</string>

    <!-- A notification is shown when connected network without internet due to private dns validation failed. This is the notification's message. [CHAR LIMIT=NONE] -->
    <string name="private_dns_broken_detailed">Private DNS server cannot be accessed</string>

    <!-- A notification is shown after the user logs in to a captive portal network, to indicate that the network should now have internet connectivity. This is the message of notification. [CHAR LIMIT=50] -->
    <string name="captive_portal_logged_in_detailed">Connected</string>
    <!-- A notification is shown when the user connects to a network that doesn't have access to some services (e.g. Push notifications may not work). This is the notification's title. [CHAR LIMIT=50] -->
+3 −0
Original line number Diff line number Diff line
@@ -593,9 +593,12 @@
  <java-symbol type="string" name="menu_space_shortcut_label" />
  <java-symbol type="string" name="menu_shift_shortcut_label" />
  <java-symbol type="string" name="menu_sym_shortcut_label" />
  <java-symbol type="string" name="mobile_no_internet" />
  <java-symbol type="string" name="notification_title" />
  <java-symbol type="string" name="other_networks_no_internet" />
  <java-symbol type="string" name="permission_request_notification_with_subtitle" />
  <java-symbol type="string" name="prepend_shortcut_label" />
  <java-symbol type="string" name="private_dns_broken_detailed" />
  <java-symbol type="string" name="paste_as_plain_text" />
  <java-symbol type="string" name="replace" />
  <java-symbol type="string" name="undo" />
+3 −0
Original line number Diff line number Diff line
@@ -127,6 +127,9 @@
    <!-- Summary for Connected wifi network without internet -->
    <string name="wifi_connected_no_internet">Connected, no internet</string>

    <!-- Summary for connected network without internet due to private dns validation failed [CHAR LIMIT=NONE] -->
    <string name="private_dns_broken">Private DNS server cannot be accessed</string>

    <!-- Summary for connected wifi network with partial internet connectivity [CHAR LIMIT=50] -->
    <string name="wifi_limited_connection">Limited connection</string>

Loading