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

Commit ef0f87ca authored by paulhu's avatar paulhu
Browse files

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: I7ec35dc1d0ff106d7b8b77d23c8e925e717bd69c
parent 654b0fff
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import android.graphics.drawable.Drawable;
import android.location.LocationManager;
import android.media.AudioManager;
import android.net.ConnectivityManager;
import android.net.TetheringManager;
import android.os.BatteryManager;
import android.os.SystemProperties;
import android.os.UserHandle;
@@ -78,10 +79,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;
+3 −4
Original line number Diff line number Diff line
@@ -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: