Loading packages/SettingsLib/src/com/android/settingslib/mobile/dataservice/DataServiceUtils.java +16 −0 Original line number Diff line number Diff line Loading @@ -23,8 +23,19 @@ 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 Loading @@ -103,6 +114,11 @@ public class DataServiceUtils { */ 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/MobileNetworkDatabase.java +1 −1 Original line number Diff line number Diff line Loading @@ -120,7 +120,7 @@ public abstract class MobileNetworkDatabase extends RoomDatabase { * Query the mobileNetwork info by the subscription ID from the MobileNetworkInfoEntity * table. */ public LiveData<MobileNetworkInfoEntity> queryMobileNetworkInfoById(String id) { public MobileNetworkInfoEntity queryMobileNetworkInfoById(String id) { return mMobileNetworkInfoDao().queryMobileNetworkInfoBySubId(id); } Loading packages/SettingsLib/src/com/android/settingslib/mobile/dataservice/MobileNetworkInfoDao.java +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ public interface MobileNetworkInfoDao { @Query("SELECT * FROM " + DataServiceUtils.MobileNetworkInfoData.TABLE_NAME + " WHERE " + DataServiceUtils.MobileNetworkInfoData.COLUMN_ID + " = :subId") LiveData<MobileNetworkInfoEntity> queryMobileNetworkInfoBySubId(String subId); MobileNetworkInfoEntity queryMobileNetworkInfoBySubId(String subId); @Query("SELECT * FROM " + DataServiceUtils.MobileNetworkInfoData.TABLE_NAME + " WHERE " + DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_MOBILE_DATA_ENABLED Loading packages/SettingsLib/src/com/android/settingslib/mobile/dataservice/MobileNetworkInfoEntity.java +51 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.settingslib.mobile.dataservice; import android.text.TextUtils; import androidx.annotation.NonNull; import androidx.room.ColumnInfo; import androidx.room.Entity; Loading @@ -28,7 +30,7 @@ public class MobileNetworkInfoEntity { boolean isContactDiscoveryVisible, boolean isMobileDataEnabled, boolean isCdmaOptions, boolean isGsmOptions, boolean isWorldMode, boolean shouldDisplayNetworkSelectOptions, boolean isTdscdmaSupported, boolean activeNetworkIsCellular, boolean showToggleForPhysicalSim) { boolean showToggleForPhysicalSim, boolean isDataRoamingEnabled) { this.subId = subId; this.isContactDiscoveryEnabled = isContactDiscoveryEnabled; this.isContactDiscoveryVisible = isContactDiscoveryVisible; Loading @@ -40,6 +42,7 @@ public class MobileNetworkInfoEntity { this.isTdscdmaSupported = isTdscdmaSupported; this.activeNetworkIsCellular = activeNetworkIsCellular; this.showToggleForPhysicalSim = showToggleForPhysicalSim; this.isDataRoamingEnabled = isDataRoamingEnabled; } @PrimaryKey Loading Loading @@ -78,6 +81,51 @@ public class MobileNetworkInfoEntity { @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; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof MobileNetworkInfoEntity)) { return false; } 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; } public String toString() { StringBuilder builder = new StringBuilder(); builder.append(" {MobileNetworkInfoEntity(subId = ") Loading @@ -102,6 +150,8 @@ public class MobileNetworkInfoEntity { .append(activeNetworkIsCellular) .append(", showToggleForPhysicalSim = ") .append(showToggleForPhysicalSim) .append(", isDataRoamingEnabled = ") .append(isDataRoamingEnabled) .append(")}"); return builder.toString(); } Loading packages/SettingsLib/src/com/android/settingslib/mobile/dataservice/UiccInfoEntity.java +41 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.settingslib.mobile.dataservice; import android.text.TextUtils; import androidx.annotation.NonNull; import androidx.room.ColumnInfo; import androidx.room.Entity; Loading Loading @@ -73,6 +75,45 @@ public class UiccInfoEntity { @ColumnInfo(name = DataServiceUtils.UiccInfoData.COLUMN_PORT_INDEX) public int portIndex; @Override public int hashCode() { int result = 17; result = 31 * result + subId.hashCode(); result = 31 * result + physicalSlotIndex.hashCode(); result = 31 * result + logicalSlotIndex; result = 31 * result + cardId; result = 31 * result + Boolean.hashCode(isEuicc); result = 31 * result + Boolean.hashCode(isMultipleEnabledProfilesSupported); result = 31 * result + cardState; result = 31 * result + Boolean.hashCode(isRemovable); result = 31 * result + Boolean.hashCode(isActive); result = 31 * result + portIndex; return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof UiccInfoEntity)) { return false; } UiccInfoEntity info = (UiccInfoEntity) obj; return TextUtils.equals(subId, info.subId) && TextUtils.equals(physicalSlotIndex, info.physicalSlotIndex) && logicalSlotIndex == info.logicalSlotIndex && cardId == info.cardId && isEuicc == info.isEuicc && isMultipleEnabledProfilesSupported == info.isMultipleEnabledProfilesSupported && cardState == info.cardState && isRemovable == info.isRemovable && isActive == info.isActive && portIndex == info.portIndex; } public String toString() { StringBuilder builder = new StringBuilder(); builder.append(" {UiccInfoEntity(subId = ") Loading Loading
packages/SettingsLib/src/com/android/settingslib/mobile/dataservice/DataServiceUtils.java +16 −0 Original line number Diff line number Diff line Loading @@ -23,8 +23,19 @@ 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 Loading @@ -103,6 +114,11 @@ public class DataServiceUtils { */ 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/MobileNetworkDatabase.java +1 −1 Original line number Diff line number Diff line Loading @@ -120,7 +120,7 @@ public abstract class MobileNetworkDatabase extends RoomDatabase { * Query the mobileNetwork info by the subscription ID from the MobileNetworkInfoEntity * table. */ public LiveData<MobileNetworkInfoEntity> queryMobileNetworkInfoById(String id) { public MobileNetworkInfoEntity queryMobileNetworkInfoById(String id) { return mMobileNetworkInfoDao().queryMobileNetworkInfoBySubId(id); } Loading
packages/SettingsLib/src/com/android/settingslib/mobile/dataservice/MobileNetworkInfoDao.java +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ public interface MobileNetworkInfoDao { @Query("SELECT * FROM " + DataServiceUtils.MobileNetworkInfoData.TABLE_NAME + " WHERE " + DataServiceUtils.MobileNetworkInfoData.COLUMN_ID + " = :subId") LiveData<MobileNetworkInfoEntity> queryMobileNetworkInfoBySubId(String subId); MobileNetworkInfoEntity queryMobileNetworkInfoBySubId(String subId); @Query("SELECT * FROM " + DataServiceUtils.MobileNetworkInfoData.TABLE_NAME + " WHERE " + DataServiceUtils.MobileNetworkInfoData.COLUMN_IS_MOBILE_DATA_ENABLED Loading
packages/SettingsLib/src/com/android/settingslib/mobile/dataservice/MobileNetworkInfoEntity.java +51 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.settingslib.mobile.dataservice; import android.text.TextUtils; import androidx.annotation.NonNull; import androidx.room.ColumnInfo; import androidx.room.Entity; Loading @@ -28,7 +30,7 @@ public class MobileNetworkInfoEntity { boolean isContactDiscoveryVisible, boolean isMobileDataEnabled, boolean isCdmaOptions, boolean isGsmOptions, boolean isWorldMode, boolean shouldDisplayNetworkSelectOptions, boolean isTdscdmaSupported, boolean activeNetworkIsCellular, boolean showToggleForPhysicalSim) { boolean showToggleForPhysicalSim, boolean isDataRoamingEnabled) { this.subId = subId; this.isContactDiscoveryEnabled = isContactDiscoveryEnabled; this.isContactDiscoveryVisible = isContactDiscoveryVisible; Loading @@ -40,6 +42,7 @@ public class MobileNetworkInfoEntity { this.isTdscdmaSupported = isTdscdmaSupported; this.activeNetworkIsCellular = activeNetworkIsCellular; this.showToggleForPhysicalSim = showToggleForPhysicalSim; this.isDataRoamingEnabled = isDataRoamingEnabled; } @PrimaryKey Loading Loading @@ -78,6 +81,51 @@ public class MobileNetworkInfoEntity { @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; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof MobileNetworkInfoEntity)) { return false; } 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; } public String toString() { StringBuilder builder = new StringBuilder(); builder.append(" {MobileNetworkInfoEntity(subId = ") Loading @@ -102,6 +150,8 @@ public class MobileNetworkInfoEntity { .append(activeNetworkIsCellular) .append(", showToggleForPhysicalSim = ") .append(showToggleForPhysicalSim) .append(", isDataRoamingEnabled = ") .append(isDataRoamingEnabled) .append(")}"); return builder.toString(); } Loading
packages/SettingsLib/src/com/android/settingslib/mobile/dataservice/UiccInfoEntity.java +41 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.settingslib.mobile.dataservice; import android.text.TextUtils; import androidx.annotation.NonNull; import androidx.room.ColumnInfo; import androidx.room.Entity; Loading Loading @@ -73,6 +75,45 @@ public class UiccInfoEntity { @ColumnInfo(name = DataServiceUtils.UiccInfoData.COLUMN_PORT_INDEX) public int portIndex; @Override public int hashCode() { int result = 17; result = 31 * result + subId.hashCode(); result = 31 * result + physicalSlotIndex.hashCode(); result = 31 * result + logicalSlotIndex; result = 31 * result + cardId; result = 31 * result + Boolean.hashCode(isEuicc); result = 31 * result + Boolean.hashCode(isMultipleEnabledProfilesSupported); result = 31 * result + cardState; result = 31 * result + Boolean.hashCode(isRemovable); result = 31 * result + Boolean.hashCode(isActive); result = 31 * result + portIndex; return result; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof UiccInfoEntity)) { return false; } UiccInfoEntity info = (UiccInfoEntity) obj; return TextUtils.equals(subId, info.subId) && TextUtils.equals(physicalSlotIndex, info.physicalSlotIndex) && logicalSlotIndex == info.logicalSlotIndex && cardId == info.cardId && isEuicc == info.isEuicc && isMultipleEnabledProfilesSupported == info.isMultipleEnabledProfilesSupported && cardState == info.cardState && isRemovable == info.isRemovable && isActive == info.isActive && portIndex == info.portIndex; } public String toString() { StringBuilder builder = new StringBuilder(); builder.append(" {UiccInfoEntity(subId = ") Loading