Replace ConnectivityManager hidden symbols on SettingsLib
Connectivity is becoming a mainline module in S, so ConnectivityManager hidden symbols can not be used for outside components. Besides, most Tethering relevant methods or variables on CM are migrated to TetheringManager. So replace all these methods or variables from ConnectivityManager to TetheringManager on SettingsLib. Bug: 180693313 Test: atest SettingsLibRoboTests Change-Id: I11e317ed0d3aab2628082bbe6b8292fec82109a9
This commit is contained in:
@@ -25,6 +25,7 @@ import android.location.LocationManager;
|
||||
import android.media.AudioManager;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkCapabilities;
|
||||
import android.net.TetheringManager;
|
||||
import android.net.vcn.VcnTransportInfo;
|
||||
import android.net.wifi.WifiInfo;
|
||||
import android.os.BatteryManager;
|
||||
@@ -90,10 +91,10 @@ public class Utils {
|
||||
* Return string resource that best describes combination of tethering
|
||||
* options available on this device.
|
||||
*/
|
||||
public static int getTetheringLabel(ConnectivityManager cm) {
|
||||
String[] usbRegexs = cm.getTetherableUsbRegexs();
|
||||
String[] wifiRegexs = cm.getTetherableWifiRegexs();
|
||||
String[] bluetoothRegexs = cm.getTetherableBluetoothRegexs();
|
||||
public static int getTetheringLabel(TetheringManager tm) {
|
||||
String[] usbRegexs = tm.getTetherableUsbRegexs();
|
||||
String[] wifiRegexs = tm.getTetherableWifiRegexs();
|
||||
String[] bluetoothRegexs = tm.getTetherableBluetoothRegexs();
|
||||
|
||||
boolean usbAvailable = usbRegexs.length != 0;
|
||||
boolean wifiAvailable = wifiRegexs.length != 0;
|
||||
|
||||
@@ -26,7 +26,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.TetheringManager;
|
||||
import android.net.TrafficStats;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
@@ -123,9 +123,8 @@ public class UidDetailProvider {
|
||||
detail.icon = pm.getDefaultActivityIcon();
|
||||
return detail;
|
||||
case TrafficStats.UID_TETHERING:
|
||||
final ConnectivityManager cm = (ConnectivityManager) mContext.getSystemService(
|
||||
Context.CONNECTIVITY_SERVICE);
|
||||
detail.label = res.getString(Utils.getTetheringLabel(cm));
|
||||
final TetheringManager tm = mContext.getSystemService(TetheringManager.class);
|
||||
detail.label = res.getString(Utils.getTetheringLabel(tm));
|
||||
detail.icon = pm.getDefaultActivityIcon();
|
||||
return detail;
|
||||
case Process.OTA_UPDATE_UID:
|
||||
|
||||
Reference in New Issue
Block a user