OSDN Git Service

[NAN] Add method to ConfigRequest to determine if non-default
authorEtan Cohen <etancohen@google.com>
Thu, 18 Aug 2016 23:51:50 +0000 (16:51 -0700)
committerEtan Cohen <etancohen@google.com>
Fri, 19 Aug 2016 19:31:31 +0000 (12:31 -0700)
To be used in permission check.

Bug: 27696149
Change-Id: I5be5aed93c556cf24b596bd2a7c5672502f84d74

wifi/java/android/net/wifi/nan/ConfigRequest.java

index 4063af0..55e568a 100644 (file)
@@ -173,6 +173,18 @@ public class ConfigRequest implements Parcelable {
                 && mClusterLow == lhs.mClusterLow && mClusterHigh == lhs.mClusterHigh;
     }
 
+    /**
+     * Checks whether the configuration's settings which impact on-air behavior are non-default.
+     *
+     * @return true if any of the on-air-impacting settings are non-default.
+     *
+     * @hide
+     */
+    public boolean isNonDefaultOnTheAir() {
+        return mSupport5gBand || mMasterPreference != 0 || mClusterLow != CLUSTER_ID_MIN
+                || mClusterHigh != CLUSTER_ID_MAX;
+    }
+
     @Override
     public int hashCode() {
         int result = 17;