Loading packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +1 −2 Original line number Diff line number Diff line Loading @@ -2173,8 +2173,7 @@ class DatabaseHelper extends SQLiteOpenHelper { (1 << AudioManager.STREAM_NOTIFICATION) | (1 << AudioManager.STREAM_SYSTEM) | (1 << AudioManager.STREAM_SYSTEM_ENFORCED); if (!mContext.getResources().getBoolean( com.android.internal.R.bool.config_voice_capable)) { if (!getTelephonyManager().isVoiceCapable()) { ringerModeAffectedStreams |= (1 << AudioManager.STREAM_MUSIC); } loadSetting(stmt, Settings.System.MODE_RINGER_STREAMS_AFFECTED, Loading telephony/java/android/telephony/TelephonyManager.java +25 −11 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static android.provider.Telephony.Carriers.INVALID_APN_ID; import static com.android.internal.util.Preconditions.checkNotNull; import android.Manifest; import android.annotation.BoolRes; import android.annotation.BytesLong; import android.annotation.CallbackExecutor; import android.annotation.CurrentTimeMillisLong; Loading Loading @@ -6886,6 +6887,26 @@ public class TelephonyManager { } } // Suppressing AndroidFrameworkCompatChange because we're querying vendor // partition SDK level, not application's target SDK version. @SuppressWarnings("AndroidFrameworkCompatChange") private boolean hasCapability(@NonNull String feature, @BoolRes int legacySetting) { if (mContext == null) return true; if (mContext.getPackageManager().hasSystemFeature(feature)) return true; // Check SDK version of the vendor partition. final int vendorApiLevel = SystemProperties.getInt( "ro.vendor.api_level", Build.VERSION.DEVICE_INITIAL_SDK_INT); // Devices shipped with 2024Q2 or later are required to declare FEATURE_TELEPHONY_* // for individual sub-features (calling, messaging, data), so there's no need to check // the legacy setting. if (vendorApiLevel < Build.VENDOR_API_2024_Q2) { return mContext.getResources().getBoolean(legacySetting); } return false; } // TODO(b/316183370): replace all @code with @link in javadoc after feature is released /** * @return true if the current device is "voice capable". Loading @@ -6905,11 +6926,9 @@ public class TelephonyManager { * device (when {@code #isDeviceVoiceCapable} return {@code true}), caller should check for * subscription-level voice capability as well. See {@code #isDeviceVoiceCapable} for details. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) @Deprecated public boolean isVoiceCapable() { if (mContext == null) return true; return mContext.getResources().getBoolean( return hasCapability(PackageManager.FEATURE_TELEPHONY_CALLING, com.android.internal.R.bool.config_voice_capable); } Loading @@ -6932,7 +6951,6 @@ public class TelephonyManager { * * @see SubscriptionInfo#getServiceCapabilities() */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) @FlaggedApi(Flags.FLAG_DATA_ONLY_CELLULAR_SERVICE) public boolean isDeviceVoiceCapable() { return isVoiceCapable(); Loading @@ -6951,10 +6969,9 @@ public class TelephonyManager { * device (when {@code #isDeviceSmsCapable} return {@code true}), caller should check for * subscription-level SMS capability as well. See {@code #isDeviceSmsCapable} for details. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_MESSAGING) @Deprecated public boolean isSmsCapable() { if (mContext == null) return true; return mContext.getResources().getBoolean( return hasCapability(PackageManager.FEATURE_TELEPHONY_MESSAGING, com.android.internal.R.bool.config_sms_capable); } Loading @@ -6974,7 +6991,6 @@ public class TelephonyManager { * * @see SubscriptionInfo#getServiceCapabilities() */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_MESSAGING) @FlaggedApi(Flags.FLAG_DATA_ONLY_CELLULAR_SERVICE) public boolean isDeviceSmsCapable() { return isSmsCapable(); Loading Loading @@ -14542,10 +14558,8 @@ public class TelephonyManager { * data connections over the telephony network. * <p> */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) public boolean isDataCapable() { if (mContext == null) return true; return mContext.getResources().getBoolean( return hasCapability(PackageManager.FEATURE_TELEPHONY_DATA, com.android.internal.R.bool.config_mobile_data_capable); } telephony/java/com/android/internal/telephony/TelephonyProperties.java +2 −2 Original line number Diff line number Diff line Loading @@ -169,13 +169,13 @@ public interface TelephonyProperties /** * Set to false to disable SMS receiving, default is * the value of config_sms_capable * the value of TelephonyManager.isDeviceSmsCapable */ static final String PROPERTY_SMS_RECEIVE = "telephony.sms.receive"; /** * Set to false to disable SMS sending, default is * the value of config_sms_capable * the value of TelephonyManager.isDeviceSmsCapable */ static final String PROPERTY_SMS_SEND = "telephony.sms.send"; Loading Loading
packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +1 −2 Original line number Diff line number Diff line Loading @@ -2173,8 +2173,7 @@ class DatabaseHelper extends SQLiteOpenHelper { (1 << AudioManager.STREAM_NOTIFICATION) | (1 << AudioManager.STREAM_SYSTEM) | (1 << AudioManager.STREAM_SYSTEM_ENFORCED); if (!mContext.getResources().getBoolean( com.android.internal.R.bool.config_voice_capable)) { if (!getTelephonyManager().isVoiceCapable()) { ringerModeAffectedStreams |= (1 << AudioManager.STREAM_MUSIC); } loadSetting(stmt, Settings.System.MODE_RINGER_STREAMS_AFFECTED, Loading
telephony/java/android/telephony/TelephonyManager.java +25 −11 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static android.provider.Telephony.Carriers.INVALID_APN_ID; import static com.android.internal.util.Preconditions.checkNotNull; import android.Manifest; import android.annotation.BoolRes; import android.annotation.BytesLong; import android.annotation.CallbackExecutor; import android.annotation.CurrentTimeMillisLong; Loading Loading @@ -6886,6 +6887,26 @@ public class TelephonyManager { } } // Suppressing AndroidFrameworkCompatChange because we're querying vendor // partition SDK level, not application's target SDK version. @SuppressWarnings("AndroidFrameworkCompatChange") private boolean hasCapability(@NonNull String feature, @BoolRes int legacySetting) { if (mContext == null) return true; if (mContext.getPackageManager().hasSystemFeature(feature)) return true; // Check SDK version of the vendor partition. final int vendorApiLevel = SystemProperties.getInt( "ro.vendor.api_level", Build.VERSION.DEVICE_INITIAL_SDK_INT); // Devices shipped with 2024Q2 or later are required to declare FEATURE_TELEPHONY_* // for individual sub-features (calling, messaging, data), so there's no need to check // the legacy setting. if (vendorApiLevel < Build.VENDOR_API_2024_Q2) { return mContext.getResources().getBoolean(legacySetting); } return false; } // TODO(b/316183370): replace all @code with @link in javadoc after feature is released /** * @return true if the current device is "voice capable". Loading @@ -6905,11 +6926,9 @@ public class TelephonyManager { * device (when {@code #isDeviceVoiceCapable} return {@code true}), caller should check for * subscription-level voice capability as well. See {@code #isDeviceVoiceCapable} for details. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) @Deprecated public boolean isVoiceCapable() { if (mContext == null) return true; return mContext.getResources().getBoolean( return hasCapability(PackageManager.FEATURE_TELEPHONY_CALLING, com.android.internal.R.bool.config_voice_capable); } Loading @@ -6932,7 +6951,6 @@ public class TelephonyManager { * * @see SubscriptionInfo#getServiceCapabilities() */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) @FlaggedApi(Flags.FLAG_DATA_ONLY_CELLULAR_SERVICE) public boolean isDeviceVoiceCapable() { return isVoiceCapable(); Loading @@ -6951,10 +6969,9 @@ public class TelephonyManager { * device (when {@code #isDeviceSmsCapable} return {@code true}), caller should check for * subscription-level SMS capability as well. See {@code #isDeviceSmsCapable} for details. */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_MESSAGING) @Deprecated public boolean isSmsCapable() { if (mContext == null) return true; return mContext.getResources().getBoolean( return hasCapability(PackageManager.FEATURE_TELEPHONY_MESSAGING, com.android.internal.R.bool.config_sms_capable); } Loading @@ -6974,7 +6991,6 @@ public class TelephonyManager { * * @see SubscriptionInfo#getServiceCapabilities() */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_MESSAGING) @FlaggedApi(Flags.FLAG_DATA_ONLY_CELLULAR_SERVICE) public boolean isDeviceSmsCapable() { return isSmsCapable(); Loading Loading @@ -14542,10 +14558,8 @@ public class TelephonyManager { * data connections over the telephony network. * <p> */ @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA) public boolean isDataCapable() { if (mContext == null) return true; return mContext.getResources().getBoolean( return hasCapability(PackageManager.FEATURE_TELEPHONY_DATA, com.android.internal.R.bool.config_mobile_data_capable); }
telephony/java/com/android/internal/telephony/TelephonyProperties.java +2 −2 Original line number Diff line number Diff line Loading @@ -169,13 +169,13 @@ public interface TelephonyProperties /** * Set to false to disable SMS receiving, default is * the value of config_sms_capable * the value of TelephonyManager.isDeviceSmsCapable */ static final String PROPERTY_SMS_RECEIVE = "telephony.sms.receive"; /** * Set to false to disable SMS sending, default is * the value of config_sms_capable * the value of TelephonyManager.isDeviceSmsCapable */ static final String PROPERTY_SMS_SEND = "telephony.sms.send"; Loading