[Settings] Replace CONNECTIVITY_INTERNAL to TETHER_PRIVILEGED
Settings is using CONNECTIVITY_INTERNAL to restrict launching
tether provisoning activity by provioning apps only. However,
CONNECTIVITY_INTERNAL will be deprecated from Android R, replace
the permission to TETHER_PRIVILEGED.
Bug: 32963470
Test: atest TetherServiceTest
Change-Id: I4c8312b92de8d5d9c9090c572e54622dc4fcf9d4
diff --git a/src/com/android/settings/network/TetherProvisioningActivity.java b/src/com/android/settings/network/TetherProvisioningActivity.java
index 48c5707..d17a843 100644
--- a/src/com/android/settings/network/TetherProvisioningActivity.java
+++ b/src/com/android/settings/network/TetherProvisioningActivity.java
@@ -32,7 +32,7 @@
/**
* Activity which acts as a proxy to the tether provisioning app for sanity checks and permission
* restrictions. Specifically, the provisioning apps require
- * {@link android.permission.CONNECTIVITY_INTERNAL}, while this activity can be started by a caller
+ * {@link android.permission.TETHER_PRIVILEGED}, while this activity can be started by a caller
* with {@link android.permission.TETHER_PRIVILEGED}.
*/
public class TetherProvisioningActivity extends Activity {
diff --git a/src/com/android/settings/wifi/tether/TetherService.java b/src/com/android/settings/wifi/tether/TetherService.java
index 34daccf..235c2cc 100644
--- a/src/com/android/settings/wifi/tether/TetherService.java
+++ b/src/com/android/settings/wifi/tether/TetherService.java
@@ -88,7 +88,7 @@
String provisionResponse = getResourceForDefaultDataSubId().getString(
com.android.internal.R.string.config_mobile_hotspot_provision_response);
registerReceiver(mReceiver, new IntentFilter(provisionResponse),
- android.Manifest.permission.CONNECTIVITY_INTERNAL, null);
+ android.Manifest.permission.TETHER_PRIVILEGED, null);
SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE);
mCurrentTethers = stringToTethers(prefs.getString(KEY_TETHERS, ""));
mCurrentTypeIndex = 0;
diff --git a/tests/unit/src/com/android/settings/wifi/tether/TetherServiceTest.java b/tests/unit/src/com/android/settings/wifi/tether/TetherServiceTest.java
index 0739ef0..3d948f2 100644
--- a/tests/unit/src/com/android/settings/wifi/tether/TetherServiceTest.java
+++ b/tests/unit/src/com/android/settings/wifi/tether/TetherServiceTest.java
@@ -431,7 +431,7 @@
responseIntent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
responseIntent.putExtra(TetherService.EXTRA_RESULT, response);
context.sendBroadcast(
- responseIntent, android.Manifest.permission.CONNECTIVITY_INTERNAL);
+ responseIntent, android.Manifest.permission.TETHER_PRIVILEGED);
}
}