Loading src/com/android/settings/datausage/CellDataPreference.java +1 −2 Original line number Diff line number Diff line Loading @@ -152,8 +152,7 @@ public class CellDataPreference extends CustomDialogPreferenceCompat } private void setMobileDataEnabled(boolean enabled) { if (DataUsageSummary.LOGD) Log.d(TAG, "setMobileDataEnabled(" + enabled + "," + mSubId + ")"); Log.d(TAG, "setDataEnabledForReason (" + enabled + "," + mSubId + ")"); getContext().getSystemService(TelephonyManager.class).setDataEnabled(mSubId, enabled); setChecked(enabled); } Loading src/com/android/settings/homepage/contextualcards/conditional/CellularDataConditionController.java +3 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.telephony.PhoneStateListener; import android.telephony.PreciseDataConnectionState; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.util.Log; import com.android.settings.R; import com.android.settings.Settings; Loading @@ -32,6 +33,7 @@ import com.android.settings.network.GlobalSettingsChangeListener; import java.util.Objects; public class CellularDataConditionController implements ConditionalCardController { private static final String TAG = "CellularDataConditionController"; static final int ID = Objects.hash("CellularDataConditionController"); Loading Loading @@ -85,6 +87,7 @@ public class CellularDataConditionController implements ConditionalCardControlle @Override public void onActionClick() { Log.d(TAG, "setDataEnabledForReason true"); mTelephonyManager.setDataEnabled(true); } Loading src/com/android/settings/network/MobileNetworkRepository.java +23 −30 Original line number Diff line number Diff line Loading @@ -190,6 +190,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions return; } sExecutor.execute(() -> { Log.d(TAG, "DataRoamingObserver changed"); insertMobileNetworkInfo(mContext, mRegSubId, tm); }); boolean isDataRoamingEnabled = tm.isDataRoamingEnabled(); Loading @@ -213,10 +214,8 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions mSubscriptionManager.addOnSubscriptionsChangedListener(mContext.getMainExecutor(), this); mAirplaneModeObserver.register(mContext); if (DEBUG) { Log.d(TAG, "addRegister done"); } } sCallbacks.add(mobileNetworkCallback); observeAllSubInfo(lifecycleOwner); observeAllUiccInfo(lifecycleOwner); Loading @@ -232,10 +231,12 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions } public void addRegisterBySubId(int subId) { Log.d(TAG, "MobileDataContentObserver addRegisterBySubId: " + subId); MobileDataContentObserver dataContentObserver = new MobileDataContentObserver( new Handler(Looper.getMainLooper())); dataContentObserver.setOnMobileDataChangedListener(() -> { sExecutor.execute(() -> { Log.d(TAG, "MobileDataContentObserver changed"); insertMobileNetworkInfo(mContext, subId, getTelephonyManagerBySubId(mContext, subId)); }); Loading Loading @@ -319,11 +320,9 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions }); mTelephonyCallbackMap.clear(); mTelephonyManagerMap.clear(); if (DEBUG) { Log.d(TAG, "removeRegister done"); } } } public void updateEntity() { // Check the latest state after back to the UI. Loading Loading @@ -356,9 +355,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions } private void observeAllMobileNetworkInfo(LifecycleOwner lifecycleOwner) { if (DEBUG) { Log.d(TAG, "Observe mobile network info."); } mMobileNetworkDatabase.queryAllMobileNetworkInfo().observe( lifecycleOwner, this::onAllMobileNetworkInfoChanged); } Loading Loading @@ -434,10 +431,10 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions } mAvailableSubInfoEntityList = new ArrayList<>(availableSubInfoEntityList); } if (DEBUG) { Log.d(TAG, "onAvailableSubInfoChanged, availableSubInfoEntityList = " + availableSubInfoEntityList); } for (MobileNetworkCallback callback : sCallbacks) { callback.onAvailableSubInfoChanged(availableSubInfoEntityList); } Loading @@ -453,10 +450,10 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions .filter(SubscriptionInfoEntity::isActiveSubscription) .filter(SubscriptionInfoEntity::isSubscriptionVisible) .collect(Collectors.toList()); if (DEBUG) { Log.d(TAG, "onActiveSubInfoChanged, activeSubInfoEntityList = " + activeSubInfoEntityList); } List<SubscriptionInfoEntity> tempActiveSubInfoEntityList = new ArrayList<>( activeSubInfoEntityList); synchronized (this) { Loading Loading @@ -521,6 +518,8 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions if (DEBUG) { Log.d(TAG, "Convert subId " + subId + " to SubscriptionInfoEntity: " + subInfoEntity); } else { Log.d(TAG, "insertSubsInfo into SubscriptionInfoEntity"); } mMobileNetworkDatabase.insertSubsInfo(subInfoEntity); mMetricsFeatureProvider.action(mContext, Loading @@ -534,9 +533,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions } private void deleteAllInfoBySubId(String subId) { if (DEBUG) { Log.d(TAG, "deleteAllInfoBySubId, subId = " + subId); } mMobileNetworkDatabase.deleteSubInfoBySubId(subId); mMobileNetworkDatabase.deleteUiccInfoBySubId(subId); mMobileNetworkDatabase.deleteMobileNetworkInfoBySubId(subId); Loading Loading @@ -617,10 +614,10 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions MobileNetworkInfoEntity mobileNetworkInfoEntity = convertToMobileNetworkInfoEntity(context, subId, telephonyManager); if (DEBUG) { Log.d(TAG, "insertMobileNetworkInfo, mobileNetworkInfoEntity = " + mobileNetworkInfoEntity); } if (mobileNetworkInfoEntity == null) { return; Loading @@ -642,7 +639,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions if (telephonyManager != null) { isDataEnabled = telephonyManager.isDataEnabled(); isDataRoamingEnabled = telephonyManager.isDataRoamingEnabled(); } else if (DEBUG) { } else { Log.d(TAG, "TelephonyManager is null, subId = " + subId); } Loading Loading @@ -671,17 +668,13 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions private boolean isMultipleEnabledProfilesSupported(TelephonyManager telephonyManager) { if (telephonyManager == null) { if (DEBUG) { Log.d(TAG, "TelephonyManager is null"); } return false; } List<UiccCardInfo> cardInfos = telephonyManager.getUiccCardsInfo(); if (cardInfos == null) { if (DEBUG) { Log.d(TAG, "UICC card info list is empty."); } return false; } return cardInfos.stream().anyMatch( Loading src/com/android/settings/network/ProviderModelSlice.java +2 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,7 @@ public class ProviderModelSlice extends WifiSlice { // If we need to display a reminder dialog box, do nothing here. return; } else { log("setMobileDataEnabled: " + newState); MobileNetworkUtils.setMobileDataEnabled(mContext, defaultSubId, newState, false /* disableOtherSubscriptions */); } Loading Loading @@ -251,6 +252,7 @@ public class ProviderModelSlice extends WifiSlice { .setPositiveButton( com.android.internal.R.string.alert_windows_notification_turn_off_action, (dialog, which) -> { log("setMobileDataEnabled: false"); MobileNetworkUtils.setMobileDataEnabled(mContext, defaultSubId, false /* enabled */, false /* disableOtherSubscriptions */); Loading src/com/android/settings/network/telephony/MobileDataDialogFragment.java +4 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.content.DialogInterface; import android.os.Bundle; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; import android.util.Log; import androidx.appcompat.app.AlertDialog; Loading @@ -40,6 +41,7 @@ import com.android.settings.wifi.WifiPickerTrackerHelper; */ public class MobileDataDialogFragment extends InstrumentedDialogFragment implements DialogInterface.OnClickListener { private static final String TAG = "MobileDataDialogFragment"; public static final int TYPE_DISABLE_DIALOG = 0; public static final int TYPE_MULTI_SIM_DIALOG = 1; Loading Loading @@ -129,6 +131,7 @@ public class MobileDataDialogFragment extends InstrumentedDialogFragment impleme public void onClick(DialogInterface dialog, int which) { switch (mType) { case TYPE_DISABLE_DIALOG: Log.d(TAG, "setMobileDataEnabled: false"); MobileNetworkUtils.setMobileDataEnabled(getContext(), mSubId, false /* enabled */, false /* disableOtherSubscriptions */); if (mWifiPickerTrackerHelper != null Loading @@ -138,6 +141,7 @@ public class MobileDataDialogFragment extends InstrumentedDialogFragment impleme break; case TYPE_MULTI_SIM_DIALOG: mSubscriptionManager.setDefaultDataSubId(mSubId); Log.d(TAG, "setMobileDataEnabled: true"); MobileNetworkUtils.setMobileDataEnabled(getContext(), mSubId, true /* enabled */, true /* disableOtherSubscriptions */); if (mWifiPickerTrackerHelper != null Loading Loading
src/com/android/settings/datausage/CellDataPreference.java +1 −2 Original line number Diff line number Diff line Loading @@ -152,8 +152,7 @@ public class CellDataPreference extends CustomDialogPreferenceCompat } private void setMobileDataEnabled(boolean enabled) { if (DataUsageSummary.LOGD) Log.d(TAG, "setMobileDataEnabled(" + enabled + "," + mSubId + ")"); Log.d(TAG, "setDataEnabledForReason (" + enabled + "," + mSubId + ")"); getContext().getSystemService(TelephonyManager.class).setDataEnabled(mSubId, enabled); setChecked(enabled); } Loading
src/com/android/settings/homepage/contextualcards/conditional/CellularDataConditionController.java +3 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.telephony.PhoneStateListener; import android.telephony.PreciseDataConnectionState; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.util.Log; import com.android.settings.R; import com.android.settings.Settings; Loading @@ -32,6 +33,7 @@ import com.android.settings.network.GlobalSettingsChangeListener; import java.util.Objects; public class CellularDataConditionController implements ConditionalCardController { private static final String TAG = "CellularDataConditionController"; static final int ID = Objects.hash("CellularDataConditionController"); Loading Loading @@ -85,6 +87,7 @@ public class CellularDataConditionController implements ConditionalCardControlle @Override public void onActionClick() { Log.d(TAG, "setDataEnabledForReason true"); mTelephonyManager.setDataEnabled(true); } Loading
src/com/android/settings/network/MobileNetworkRepository.java +23 −30 Original line number Diff line number Diff line Loading @@ -190,6 +190,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions return; } sExecutor.execute(() -> { Log.d(TAG, "DataRoamingObserver changed"); insertMobileNetworkInfo(mContext, mRegSubId, tm); }); boolean isDataRoamingEnabled = tm.isDataRoamingEnabled(); Loading @@ -213,10 +214,8 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions mSubscriptionManager.addOnSubscriptionsChangedListener(mContext.getMainExecutor(), this); mAirplaneModeObserver.register(mContext); if (DEBUG) { Log.d(TAG, "addRegister done"); } } sCallbacks.add(mobileNetworkCallback); observeAllSubInfo(lifecycleOwner); observeAllUiccInfo(lifecycleOwner); Loading @@ -232,10 +231,12 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions } public void addRegisterBySubId(int subId) { Log.d(TAG, "MobileDataContentObserver addRegisterBySubId: " + subId); MobileDataContentObserver dataContentObserver = new MobileDataContentObserver( new Handler(Looper.getMainLooper())); dataContentObserver.setOnMobileDataChangedListener(() -> { sExecutor.execute(() -> { Log.d(TAG, "MobileDataContentObserver changed"); insertMobileNetworkInfo(mContext, subId, getTelephonyManagerBySubId(mContext, subId)); }); Loading Loading @@ -319,11 +320,9 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions }); mTelephonyCallbackMap.clear(); mTelephonyManagerMap.clear(); if (DEBUG) { Log.d(TAG, "removeRegister done"); } } } public void updateEntity() { // Check the latest state after back to the UI. Loading Loading @@ -356,9 +355,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions } private void observeAllMobileNetworkInfo(LifecycleOwner lifecycleOwner) { if (DEBUG) { Log.d(TAG, "Observe mobile network info."); } mMobileNetworkDatabase.queryAllMobileNetworkInfo().observe( lifecycleOwner, this::onAllMobileNetworkInfoChanged); } Loading Loading @@ -434,10 +431,10 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions } mAvailableSubInfoEntityList = new ArrayList<>(availableSubInfoEntityList); } if (DEBUG) { Log.d(TAG, "onAvailableSubInfoChanged, availableSubInfoEntityList = " + availableSubInfoEntityList); } for (MobileNetworkCallback callback : sCallbacks) { callback.onAvailableSubInfoChanged(availableSubInfoEntityList); } Loading @@ -453,10 +450,10 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions .filter(SubscriptionInfoEntity::isActiveSubscription) .filter(SubscriptionInfoEntity::isSubscriptionVisible) .collect(Collectors.toList()); if (DEBUG) { Log.d(TAG, "onActiveSubInfoChanged, activeSubInfoEntityList = " + activeSubInfoEntityList); } List<SubscriptionInfoEntity> tempActiveSubInfoEntityList = new ArrayList<>( activeSubInfoEntityList); synchronized (this) { Loading Loading @@ -521,6 +518,8 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions if (DEBUG) { Log.d(TAG, "Convert subId " + subId + " to SubscriptionInfoEntity: " + subInfoEntity); } else { Log.d(TAG, "insertSubsInfo into SubscriptionInfoEntity"); } mMobileNetworkDatabase.insertSubsInfo(subInfoEntity); mMetricsFeatureProvider.action(mContext, Loading @@ -534,9 +533,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions } private void deleteAllInfoBySubId(String subId) { if (DEBUG) { Log.d(TAG, "deleteAllInfoBySubId, subId = " + subId); } mMobileNetworkDatabase.deleteSubInfoBySubId(subId); mMobileNetworkDatabase.deleteUiccInfoBySubId(subId); mMobileNetworkDatabase.deleteMobileNetworkInfoBySubId(subId); Loading Loading @@ -617,10 +614,10 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions MobileNetworkInfoEntity mobileNetworkInfoEntity = convertToMobileNetworkInfoEntity(context, subId, telephonyManager); if (DEBUG) { Log.d(TAG, "insertMobileNetworkInfo, mobileNetworkInfoEntity = " + mobileNetworkInfoEntity); } if (mobileNetworkInfoEntity == null) { return; Loading @@ -642,7 +639,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions if (telephonyManager != null) { isDataEnabled = telephonyManager.isDataEnabled(); isDataRoamingEnabled = telephonyManager.isDataRoamingEnabled(); } else if (DEBUG) { } else { Log.d(TAG, "TelephonyManager is null, subId = " + subId); } Loading Loading @@ -671,17 +668,13 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions private boolean isMultipleEnabledProfilesSupported(TelephonyManager telephonyManager) { if (telephonyManager == null) { if (DEBUG) { Log.d(TAG, "TelephonyManager is null"); } return false; } List<UiccCardInfo> cardInfos = telephonyManager.getUiccCardsInfo(); if (cardInfos == null) { if (DEBUG) { Log.d(TAG, "UICC card info list is empty."); } return false; } return cardInfos.stream().anyMatch( Loading
src/com/android/settings/network/ProviderModelSlice.java +2 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,7 @@ public class ProviderModelSlice extends WifiSlice { // If we need to display a reminder dialog box, do nothing here. return; } else { log("setMobileDataEnabled: " + newState); MobileNetworkUtils.setMobileDataEnabled(mContext, defaultSubId, newState, false /* disableOtherSubscriptions */); } Loading Loading @@ -251,6 +252,7 @@ public class ProviderModelSlice extends WifiSlice { .setPositiveButton( com.android.internal.R.string.alert_windows_notification_turn_off_action, (dialog, which) -> { log("setMobileDataEnabled: false"); MobileNetworkUtils.setMobileDataEnabled(mContext, defaultSubId, false /* enabled */, false /* disableOtherSubscriptions */); Loading
src/com/android/settings/network/telephony/MobileDataDialogFragment.java +4 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.content.DialogInterface; import android.os.Bundle; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; import android.util.Log; import androidx.appcompat.app.AlertDialog; Loading @@ -40,6 +41,7 @@ import com.android.settings.wifi.WifiPickerTrackerHelper; */ public class MobileDataDialogFragment extends InstrumentedDialogFragment implements DialogInterface.OnClickListener { private static final String TAG = "MobileDataDialogFragment"; public static final int TYPE_DISABLE_DIALOG = 0; public static final int TYPE_MULTI_SIM_DIALOG = 1; Loading Loading @@ -129,6 +131,7 @@ public class MobileDataDialogFragment extends InstrumentedDialogFragment impleme public void onClick(DialogInterface dialog, int which) { switch (mType) { case TYPE_DISABLE_DIALOG: Log.d(TAG, "setMobileDataEnabled: false"); MobileNetworkUtils.setMobileDataEnabled(getContext(), mSubId, false /* enabled */, false /* disableOtherSubscriptions */); if (mWifiPickerTrackerHelper != null Loading @@ -138,6 +141,7 @@ public class MobileDataDialogFragment extends InstrumentedDialogFragment impleme break; case TYPE_MULTI_SIM_DIALOG: mSubscriptionManager.setDefaultDataSubId(mSubId); Log.d(TAG, "setMobileDataEnabled: true"); MobileNetworkUtils.setMobileDataEnabled(getContext(), mSubId, true /* enabled */, true /* disableOtherSubscriptions */); if (mWifiPickerTrackerHelper != null Loading