Merge "Give tethering bluetooth privilege permission" into rvc-dev
diff --git a/Tethering/Android.bp b/Tethering/Android.bp
index 0c37235..190b443 100644
--- a/Tethering/Android.bp
+++ b/Tethering/Android.bp
@@ -16,9 +16,7 @@
 
 java_defaults {
     name: "TetheringAndroidLibraryDefaults",
-    // TODO (b/146757305): change to module API once available
-    // TODO (b/148190005): change to module-libs-api-stubs-current once it is ready.
-    sdk_version: "core_platform",
+    sdk_version: "module_current",
     srcs: [
         "src/**/*.java",
         ":framework-tethering-shared-srcs",
@@ -35,15 +33,10 @@
         "net-utils-framework-common",
     ],
     libs: [
-        // Order matters: framework-tethering needs to be before the system stubs, otherwise
-        // hidden fields in the framework-tethering classes (which are also used to generate stubs)
-        // will not be found.
         "framework-tethering",
-        "android_system_stubs_current",
-        "framework-res",
+        "framework-telephony-stubs",
+        "framework-wifi-stubs-systemapi",
         "unsupportedappusage",
-        "android_system_stubs_current",
-        "framework-res",
     ],
     plugins: ["java_api_finder"],
     manifest: "AndroidManifestBase.xml",
@@ -91,9 +84,7 @@
 // Common defaults for compiling the actual APK.
 java_defaults {
     name: "TetheringAppDefaults",
-    // TODO (b/146757305): change to module API once available
-    // TODO (b/148190005): change to module-libs-api-stubs-current once it is ready.
-    sdk_version: "core_platform",
+    sdk_version: "module_current",
     privileged: true,
     jni_libs: [
         "libtetherutilsjni",
@@ -102,12 +93,7 @@
         "res",
     ],
     libs: [
-        // Order matters: framework-tethering needs to be before the system stubs, otherwise
-        // hidden fields in the framework-tethering classes (which are also used to generate stubs)
-        // will not be found.
         "framework-tethering",
-        "android_system_stubs_current",
-        "framework-res",
     ],
     jarjar_rules: "jarjar-rules.txt",
     optimize: {
diff --git a/Tethering/common/TetheringLib/api/module-lib-current.txt b/Tethering/common/TetheringLib/api/module-lib-current.txt
index e823e17..754584e 100644
--- a/Tethering/common/TetheringLib/api/module-lib-current.txt
+++ b/Tethering/common/TetheringLib/api/module-lib-current.txt
@@ -110,16 +110,16 @@
   }
 
   public static class TetheringManager.TetheringRequest {
-  }
-
-  public static class TetheringManager.TetheringRequest.Builder {
-    ctor public TetheringManager.TetheringRequest.Builder(int);
-    method @NonNull public android.net.TetheringManager.TetheringRequest build();
     method @Nullable public android.net.LinkAddress getClientStaticIpv4Address();
     method @Nullable public android.net.LinkAddress getLocalIpv4Address();
     method public boolean getShouldShowEntitlementUi();
     method public int getTetheringType();
     method public boolean isExemptFromEntitlementCheck();
+  }
+
+  public static class TetheringManager.TetheringRequest.Builder {
+    ctor public TetheringManager.TetheringRequest.Builder(int);
+    method @NonNull public android.net.TetheringManager.TetheringRequest build();
     method @NonNull @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public android.net.TetheringManager.TetheringRequest.Builder setExemptFromEntitlementCheck(boolean);
     method @NonNull @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public android.net.TetheringManager.TetheringRequest.Builder setShouldShowEntitlementUi(boolean);
     method @NonNull @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public android.net.TetheringManager.TetheringRequest.Builder setStaticIpv4Addresses(@NonNull android.net.LinkAddress, @NonNull android.net.LinkAddress);
diff --git a/Tethering/common/TetheringLib/api/system-current.txt b/Tethering/common/TetheringLib/api/system-current.txt
index 4ac44ba..edd1ebb 100644
--- a/Tethering/common/TetheringLib/api/system-current.txt
+++ b/Tethering/common/TetheringLib/api/system-current.txt
@@ -80,16 +80,16 @@
   }
 
   public static class TetheringManager.TetheringRequest {
-  }
-
-  public static class TetheringManager.TetheringRequest.Builder {
-    ctor public TetheringManager.TetheringRequest.Builder(int);
-    method @NonNull public android.net.TetheringManager.TetheringRequest build();
     method @Nullable public android.net.LinkAddress getClientStaticIpv4Address();
     method @Nullable public android.net.LinkAddress getLocalIpv4Address();
     method public boolean getShouldShowEntitlementUi();
     method public int getTetheringType();
     method public boolean isExemptFromEntitlementCheck();
+  }
+
+  public static class TetheringManager.TetheringRequest.Builder {
+    ctor public TetheringManager.TetheringRequest.Builder(int);
+    method @NonNull public android.net.TetheringManager.TetheringRequest build();
     method @NonNull @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public android.net.TetheringManager.TetheringRequest.Builder setExemptFromEntitlementCheck(boolean);
     method @NonNull @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public android.net.TetheringManager.TetheringRequest.Builder setShouldShowEntitlementUi(boolean);
     method @NonNull @RequiresPermission(android.Manifest.permission.TETHER_PRIVILEGED) public android.net.TetheringManager.TetheringRequest.Builder setStaticIpv4Addresses(@NonNull android.net.LinkAddress, @NonNull android.net.LinkAddress);
diff --git a/Tethering/common/TetheringLib/src/android/net/TetheringManager.java b/Tethering/common/TetheringLib/src/android/net/TetheringManager.java
index bd65fc2..3509801 100644
--- a/Tethering/common/TetheringLib/src/android/net/TetheringManager.java
+++ b/Tethering/common/TetheringLib/src/android/net/TetheringManager.java
@@ -620,33 +620,40 @@
             public TetheringRequest build() {
                 return new TetheringRequest(mBuilderParcel);
             }
+        }
 
-            @Nullable
-            public LinkAddress getLocalIpv4Address() {
-                return mBuilderParcel.localIPv4Address;
-            }
+        /**
+         * Get the local IPv4 address, if one was configured with
+         * {@link Builder#setStaticIpv4Addresses}.
+         */
+        @Nullable
+        public LinkAddress getLocalIpv4Address() {
+            return mRequestParcel.localIPv4Address;
+        }
 
-            /** Get static client address. */
-            @Nullable
-            public LinkAddress getClientStaticIpv4Address() {
-                return mBuilderParcel.staticClientAddress;
-            }
+        /**
+         * Get the static IPv4 address of the client, if one was configured with
+         * {@link Builder#setStaticIpv4Addresses}.
+         */
+        @Nullable
+        public LinkAddress getClientStaticIpv4Address() {
+            return mRequestParcel.staticClientAddress;
+        }
 
-            /** Get tethering type. */
-            @TetheringType
-            public int getTetheringType() {
-                return mBuilderParcel.tetheringType;
-            }
+        /** Get tethering type. */
+        @TetheringType
+        public int getTetheringType() {
+            return mRequestParcel.tetheringType;
+        }
 
-            /** Check if exempt from entitlement check. */
-            public boolean isExemptFromEntitlementCheck() {
-                return mBuilderParcel.exemptFromEntitlementCheck;
-            }
+        /** Check if exempt from entitlement check. */
+        public boolean isExemptFromEntitlementCheck() {
+            return mRequestParcel.exemptFromEntitlementCheck;
+        }
 
-            /** Check if show entitlement ui.  */
-            public boolean getShouldShowEntitlementUi() {
-                return mBuilderParcel.showProvisioningUi;
-            }
+        /** Check if show entitlement ui.  */
+        public boolean getShouldShowEntitlementUi() {
+            return mRequestParcel.showProvisioningUi;
         }
 
         /**