Loading packages/SettingsLib/src/com/android/settingslib/mobile/dataservice/DataServiceUtils.java +0 −68 Original line number Diff line number Diff line Loading @@ -23,19 +23,8 @@ import android.telephony.UiccPortInfo; import android.telephony.UiccSlotInfo; import android.telephony.UiccSlotMapping; import java.util.List; public class DataServiceUtils { public static <T> boolean shouldUpdateEntityList(List<T> oldList, List<T> newList) { if ((oldList != null && (newList.isEmpty() || !newList.equals(oldList))) || (!newList.isEmpty() && oldList == null)) { return true; } return false; } /** * Represents columns of the MobileNetworkInfoData table, define these columns from * {@see MobileNetworkUtils} or relevant common APIs. Loading @@ -51,74 +40,17 @@ public class DataServiceUtils { */ public static final String COLUMN_ID = "subId"; /** * The name of the contact discovery enabled state column, * {@see MobileNetworkUtils#isContactDiscoveryEnabled(Context, int)}. */ public static final String COLUMN_IS_CONTACT_DISCOVERY_ENABLED = "isContactDiscoveryEnabled"; /** * The name of the contact discovery visible state column, * {@see MobileNetworkUtils#isContactDiscoveryEnabled(Context, int)}. */ public static final String COLUMN_IS_CONTACT_DISCOVERY_VISIBLE = "isContactDiscoveryVisible"; /** * The name of the mobile network data state column, * {@see MobileNetworkUtils#isMobileDataEnabled(Context)}. */ public static final String COLUMN_IS_MOBILE_DATA_ENABLED = "isMobileDataEnabled"; /** * The name of the CDMA option state column, * {@see MobileNetworkUtils#isCdmaOptions(Context, int)}. */ public static final String COLUMN_IS_CDMA_OPTIONS = "isCdmaOptions"; /** * The name of the GSM option state column, * {@see MobileNetworkUtils#isGsmOptions(Context, int)}. */ public static final String COLUMN_IS_GSM_OPTIONS = "isGsmOptions"; /** * The name of the world mode state column, * {@see MobileNetworkUtils#isWorldMode(Context, int)}. */ public static final String COLUMN_IS_WORLD_MODE = "isWorldMode"; /** * The name of the display network select options state column, * {@see MobileNetworkUtils#shouldDisplayNetworkSelectOptions(Context, int)}. */ public static final String COLUMN_SHOULD_DISPLAY_NETWORK_SELECT_OPTIONS = "shouldDisplayNetworkSelectOptions"; /** * The name of the TDSCDMA supported state column, * {@see MobileNetworkUtils#isTdscdmaSupported(Context, int)}. */ public static final String COLUMN_IS_TDSCDMA_SUPPORTED = "isTdscdmaSupported"; /** * The name of the active network is cellular state column, * {@see MobileNetworkUtils#activeNetworkIsCellular(Context)}. */ public static final String COLUMN_ACTIVE_NETWORK_IS_CELLULAR = "activeNetworkIsCellular"; /** * The name of the show toggle for physicalSim state column, * {@see SubscriptionUtil#showToggleForPhysicalSim(SubscriptionManager)}. */ public static final String COLUMN_SHOW_TOGGLE_FOR_PHYSICAL_SIM = "showToggleForPhysicalSim"; /** * The name of the subscription's data roaming state column, * {@see TelephonyManager#isDataRoamingEnabled()}. */ public static final String COLUMN_IS_DATA_ROAMING_ENABLED = "isDataRoamingEnabled"; } /** Loading packages/SettingsLib/src/com/android/settingslib/mobile/dataservice/MobileNetworkInfoEntity.java +3 −79 Original line number Diff line number Diff line Loading @@ -26,23 +26,11 @@ import androidx.room.PrimaryKey; @Entity(tableName = DataServiceUtils.MobileNetworkInfoData.TABLE_NAME) public class MobileNetworkInfoEntity { public MobileNetworkInfoEntity(@NonNull String subId, boolean isContactDiscoveryEnabled, boolean isContactDiscoveryVisible, boolean isMobileDataEnabled, boolean isCdmaOptions, boolean isGsmOptions, boolean isWorldMode, boolean shouldDisplayNetworkSelectOptions, boolean isTdscdmaSupported, boolean activeNetworkIsCellular, boolean showToggleForPhysicalSim, boolean isDataRoamingEnabled) { public MobileNetworkInfoEntity(@NonNull String subId, boolean isMobileDataEnabled, boolean showToggleForPhysicalSim) { this.subId = subId; this.isContactDiscoveryEnabled = isContactDiscoveryEnabled; this.isContactDiscoveryVisible = isContactDiscoveryVisible; this.isMobileDataEnabled = isMobileDataEnabled; this.isCdmaOptions = isCdmaOptions; this.isGsmOptions = isGsmOptions; this.isWorldMode = isWorldMode; this.shouldDisplayNetworkSelectOptions = shouldDisplayNetworkSelectOptions; this.isTdscdmaSupported = isTdscdmaSupported; this.activeNetworkIsCellular = activeNetworkIsCellular; this.showToggleForPhysicalSim = showToggleForPhysicalSim; this.isDataRoamingEnabled = isDataRoamingEnabled; } @PrimaryKey Loading @@ -50,55 +38,18 @@ public class MobileNetworkInfoEntity { @NonNull public String subId; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_CONTACT_DISCOVERY_ENABLED) public boolean isContactDiscoveryEnabled; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_CONTACT_DISCOVERY_VISIBLE) public boolean isContactDiscoveryVisible; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_MOBILE_DATA_ENABLED) public boolean isMobileDataEnabled; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_CDMA_OPTIONS) public boolean isCdmaOptions; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_GSM_OPTIONS) public boolean isGsmOptions; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_WORLD_MODE) public boolean isWorldMode; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_SHOULD_DISPLAY_NETWORK_SELECT_OPTIONS) public boolean shouldDisplayNetworkSelectOptions; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_TDSCDMA_SUPPORTED) public boolean isTdscdmaSupported; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_ACTIVE_NETWORK_IS_CELLULAR) public boolean activeNetworkIsCellular; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_SHOW_TOGGLE_FOR_PHYSICAL_SIM) public boolean showToggleForPhysicalSim; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_DATA_ROAMING_ENABLED) public boolean isDataRoamingEnabled; @Override public int hashCode() { int result = 17; result = 31 * result + subId.hashCode(); result = 31 * result + Boolean.hashCode(isContactDiscoveryEnabled); result = 31 * result + Boolean.hashCode(isContactDiscoveryVisible); result = 31 * result + Boolean.hashCode(isMobileDataEnabled); result = 31 * result + Boolean.hashCode(isCdmaOptions); result = 31 * result + Boolean.hashCode(isGsmOptions); result = 31 * result + Boolean.hashCode(isWorldMode); result = 31 * result + Boolean.hashCode(shouldDisplayNetworkSelectOptions); result = 31 * result + Boolean.hashCode(isTdscdmaSupported); result = 31 * result + Boolean.hashCode(activeNetworkIsCellular); result = 31 * result + Boolean.hashCode(showToggleForPhysicalSim); result = 31 * result + Boolean.hashCode(isDataRoamingEnabled); return result; } Loading @@ -113,45 +64,18 @@ public class MobileNetworkInfoEntity { MobileNetworkInfoEntity info = (MobileNetworkInfoEntity) obj; return TextUtils.equals(subId, info.subId) && isContactDiscoveryEnabled == info.isContactDiscoveryEnabled && isContactDiscoveryVisible == info.isContactDiscoveryVisible && isMobileDataEnabled == info.isMobileDataEnabled && isCdmaOptions == info.isCdmaOptions && isGsmOptions == info.isGsmOptions && isWorldMode == info.isWorldMode && shouldDisplayNetworkSelectOptions == info.shouldDisplayNetworkSelectOptions && isTdscdmaSupported == info.isTdscdmaSupported && activeNetworkIsCellular == info.activeNetworkIsCellular && showToggleForPhysicalSim == info.showToggleForPhysicalSim && isDataRoamingEnabled == info.isDataRoamingEnabled; && showToggleForPhysicalSim == info.showToggleForPhysicalSim; } public String toString() { StringBuilder builder = new StringBuilder(); builder.append(" {MobileNetworkInfoEntity(subId = ") .append(subId) .append(", isContactDiscoveryEnabled = ") .append(isContactDiscoveryEnabled) .append(", isContactDiscoveryVisible = ") .append(isContactDiscoveryVisible) .append(", isMobileDataEnabled = ") .append(isMobileDataEnabled) .append(", isCdmaOptions = ") .append(isCdmaOptions) .append(", isGsmOptions = ") .append(isGsmOptions) .append(", isWorldMode = ") .append(isWorldMode) .append(", shouldDisplayNetworkSelectOptions = ") .append(shouldDisplayNetworkSelectOptions) .append(", isTdscdmaSupported = ") .append(isTdscdmaSupported) .append(", activeNetworkIsCellular = ") .append(activeNetworkIsCellular) .append(", showToggleForPhysicalSim = ") .append(showToggleForPhysicalSim) .append(", isDataRoamingEnabled = ") .append(isDataRoamingEnabled) .append(")}"); return builder.toString(); } Loading Loading
packages/SettingsLib/src/com/android/settingslib/mobile/dataservice/DataServiceUtils.java +0 −68 Original line number Diff line number Diff line Loading @@ -23,19 +23,8 @@ import android.telephony.UiccPortInfo; import android.telephony.UiccSlotInfo; import android.telephony.UiccSlotMapping; import java.util.List; public class DataServiceUtils { public static <T> boolean shouldUpdateEntityList(List<T> oldList, List<T> newList) { if ((oldList != null && (newList.isEmpty() || !newList.equals(oldList))) || (!newList.isEmpty() && oldList == null)) { return true; } return false; } /** * Represents columns of the MobileNetworkInfoData table, define these columns from * {@see MobileNetworkUtils} or relevant common APIs. Loading @@ -51,74 +40,17 @@ public class DataServiceUtils { */ public static final String COLUMN_ID = "subId"; /** * The name of the contact discovery enabled state column, * {@see MobileNetworkUtils#isContactDiscoveryEnabled(Context, int)}. */ public static final String COLUMN_IS_CONTACT_DISCOVERY_ENABLED = "isContactDiscoveryEnabled"; /** * The name of the contact discovery visible state column, * {@see MobileNetworkUtils#isContactDiscoveryEnabled(Context, int)}. */ public static final String COLUMN_IS_CONTACT_DISCOVERY_VISIBLE = "isContactDiscoveryVisible"; /** * The name of the mobile network data state column, * {@see MobileNetworkUtils#isMobileDataEnabled(Context)}. */ public static final String COLUMN_IS_MOBILE_DATA_ENABLED = "isMobileDataEnabled"; /** * The name of the CDMA option state column, * {@see MobileNetworkUtils#isCdmaOptions(Context, int)}. */ public static final String COLUMN_IS_CDMA_OPTIONS = "isCdmaOptions"; /** * The name of the GSM option state column, * {@see MobileNetworkUtils#isGsmOptions(Context, int)}. */ public static final String COLUMN_IS_GSM_OPTIONS = "isGsmOptions"; /** * The name of the world mode state column, * {@see MobileNetworkUtils#isWorldMode(Context, int)}. */ public static final String COLUMN_IS_WORLD_MODE = "isWorldMode"; /** * The name of the display network select options state column, * {@see MobileNetworkUtils#shouldDisplayNetworkSelectOptions(Context, int)}. */ public static final String COLUMN_SHOULD_DISPLAY_NETWORK_SELECT_OPTIONS = "shouldDisplayNetworkSelectOptions"; /** * The name of the TDSCDMA supported state column, * {@see MobileNetworkUtils#isTdscdmaSupported(Context, int)}. */ public static final String COLUMN_IS_TDSCDMA_SUPPORTED = "isTdscdmaSupported"; /** * The name of the active network is cellular state column, * {@see MobileNetworkUtils#activeNetworkIsCellular(Context)}. */ public static final String COLUMN_ACTIVE_NETWORK_IS_CELLULAR = "activeNetworkIsCellular"; /** * The name of the show toggle for physicalSim state column, * {@see SubscriptionUtil#showToggleForPhysicalSim(SubscriptionManager)}. */ public static final String COLUMN_SHOW_TOGGLE_FOR_PHYSICAL_SIM = "showToggleForPhysicalSim"; /** * The name of the subscription's data roaming state column, * {@see TelephonyManager#isDataRoamingEnabled()}. */ public static final String COLUMN_IS_DATA_ROAMING_ENABLED = "isDataRoamingEnabled"; } /** Loading
packages/SettingsLib/src/com/android/settingslib/mobile/dataservice/MobileNetworkInfoEntity.java +3 −79 Original line number Diff line number Diff line Loading @@ -26,23 +26,11 @@ import androidx.room.PrimaryKey; @Entity(tableName = DataServiceUtils.MobileNetworkInfoData.TABLE_NAME) public class MobileNetworkInfoEntity { public MobileNetworkInfoEntity(@NonNull String subId, boolean isContactDiscoveryEnabled, boolean isContactDiscoveryVisible, boolean isMobileDataEnabled, boolean isCdmaOptions, boolean isGsmOptions, boolean isWorldMode, boolean shouldDisplayNetworkSelectOptions, boolean isTdscdmaSupported, boolean activeNetworkIsCellular, boolean showToggleForPhysicalSim, boolean isDataRoamingEnabled) { public MobileNetworkInfoEntity(@NonNull String subId, boolean isMobileDataEnabled, boolean showToggleForPhysicalSim) { this.subId = subId; this.isContactDiscoveryEnabled = isContactDiscoveryEnabled; this.isContactDiscoveryVisible = isContactDiscoveryVisible; this.isMobileDataEnabled = isMobileDataEnabled; this.isCdmaOptions = isCdmaOptions; this.isGsmOptions = isGsmOptions; this.isWorldMode = isWorldMode; this.shouldDisplayNetworkSelectOptions = shouldDisplayNetworkSelectOptions; this.isTdscdmaSupported = isTdscdmaSupported; this.activeNetworkIsCellular = activeNetworkIsCellular; this.showToggleForPhysicalSim = showToggleForPhysicalSim; this.isDataRoamingEnabled = isDataRoamingEnabled; } @PrimaryKey Loading @@ -50,55 +38,18 @@ public class MobileNetworkInfoEntity { @NonNull public String subId; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_CONTACT_DISCOVERY_ENABLED) public boolean isContactDiscoveryEnabled; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_CONTACT_DISCOVERY_VISIBLE) public boolean isContactDiscoveryVisible; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_MOBILE_DATA_ENABLED) public boolean isMobileDataEnabled; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_CDMA_OPTIONS) public boolean isCdmaOptions; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_GSM_OPTIONS) public boolean isGsmOptions; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_WORLD_MODE) public boolean isWorldMode; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_SHOULD_DISPLAY_NETWORK_SELECT_OPTIONS) public boolean shouldDisplayNetworkSelectOptions; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_TDSCDMA_SUPPORTED) public boolean isTdscdmaSupported; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_ACTIVE_NETWORK_IS_CELLULAR) public boolean activeNetworkIsCellular; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_SHOW_TOGGLE_FOR_PHYSICAL_SIM) public boolean showToggleForPhysicalSim; @ColumnInfo(name = DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_DATA_ROAMING_ENABLED) public boolean isDataRoamingEnabled; @Override public int hashCode() { int result = 17; result = 31 * result + subId.hashCode(); result = 31 * result + Boolean.hashCode(isContactDiscoveryEnabled); result = 31 * result + Boolean.hashCode(isContactDiscoveryVisible); result = 31 * result + Boolean.hashCode(isMobileDataEnabled); result = 31 * result + Boolean.hashCode(isCdmaOptions); result = 31 * result + Boolean.hashCode(isGsmOptions); result = 31 * result + Boolean.hashCode(isWorldMode); result = 31 * result + Boolean.hashCode(shouldDisplayNetworkSelectOptions); result = 31 * result + Boolean.hashCode(isTdscdmaSupported); result = 31 * result + Boolean.hashCode(activeNetworkIsCellular); result = 31 * result + Boolean.hashCode(showToggleForPhysicalSim); result = 31 * result + Boolean.hashCode(isDataRoamingEnabled); return result; } Loading @@ -113,45 +64,18 @@ public class MobileNetworkInfoEntity { MobileNetworkInfoEntity info = (MobileNetworkInfoEntity) obj; return TextUtils.equals(subId, info.subId) && isContactDiscoveryEnabled == info.isContactDiscoveryEnabled && isContactDiscoveryVisible == info.isContactDiscoveryVisible && isMobileDataEnabled == info.isMobileDataEnabled && isCdmaOptions == info.isCdmaOptions && isGsmOptions == info.isGsmOptions && isWorldMode == info.isWorldMode && shouldDisplayNetworkSelectOptions == info.shouldDisplayNetworkSelectOptions && isTdscdmaSupported == info.isTdscdmaSupported && activeNetworkIsCellular == info.activeNetworkIsCellular && showToggleForPhysicalSim == info.showToggleForPhysicalSim && isDataRoamingEnabled == info.isDataRoamingEnabled; && showToggleForPhysicalSim == info.showToggleForPhysicalSim; } public String toString() { StringBuilder builder = new StringBuilder(); builder.append(" {MobileNetworkInfoEntity(subId = ") .append(subId) .append(", isContactDiscoveryEnabled = ") .append(isContactDiscoveryEnabled) .append(", isContactDiscoveryVisible = ") .append(isContactDiscoveryVisible) .append(", isMobileDataEnabled = ") .append(isMobileDataEnabled) .append(", isCdmaOptions = ") .append(isCdmaOptions) .append(", isGsmOptions = ") .append(isGsmOptions) .append(", isWorldMode = ") .append(isWorldMode) .append(", shouldDisplayNetworkSelectOptions = ") .append(shouldDisplayNetworkSelectOptions) .append(", isTdscdmaSupported = ") .append(isTdscdmaSupported) .append(", activeNetworkIsCellular = ") .append(activeNetworkIsCellular) .append(", showToggleForPhysicalSim = ") .append(showToggleForPhysicalSim) .append(", isDataRoamingEnabled = ") .append(isDataRoamingEnabled) .append(")}"); return builder.toString(); } Loading