Messaging: Remove cell broadcasts

* Packagemanager doesn't tell us about its' availability anymore
* It's accessible from notification settings, no need for the app to
  be able to launch them

Change-Id: I10b7742917f8639c94b0187f158cc30156f90e92
This commit is contained in:
Michael W
2024-12-08 17:01:36 +01:00
parent 6a10100821
commit 009df43b06
5 changed files with 4 additions and 58 deletions

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Copyright (C) 2024 The LineageOS Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -54,10 +55,6 @@
android:summary="@string/delivery_reports_pref_summary"
android:defaultValue="@bool/delivery_reports_pref_default" />
<Preference
android:key="@string/wireless_alerts_key"
android:title="@string/wireless_alerts_title"/>
<PreferenceScreen
android:key="@string/sms_apns_key"
android:title="@string/sms_apns_title" />

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Copyright (C) 2024 The LineageOS Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -54,10 +55,6 @@
android:summary="@string/delivery_reports_pref_summary"
android:defaultValue="@bool/delivery_reports_pref_default" />
<Preference
android:key="@string/wireless_alerts_key"
android:title="@string/wireless_alerts_title"/>
<PreferenceScreen
android:key="@string/sms_apns_key"
android:title="@string/sms_apns_title" />

View File

@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -264,11 +265,6 @@ public abstract class UIIntents {
*/
public abstract Intent getViewUrlIntent(final String url);
/**
* Get an intent to launch the wireless alert viewer.
*/
public abstract Intent getWirelessAlertsIntent();
/**
* Get an intent to launch the dialog for changing the default SMS App.
*/

View File

@@ -75,8 +75,6 @@ import com.android.messaging.util.UriUtil;
* A central repository of Intents used to start activities.
*/
public class UIIntentsImpl extends UIIntents {
private static final String CELL_BROADCAST_LIST_ACTIVITY =
"com.android.cellbroadcastreceiver.CellBroadcastListActivity";
private static final String CALL_TARGET_CLICK_KEY = "touchPoint";
private static final String CALL_TARGET_CLICK_EXTRA_KEY =
"android.telecom.extra.OUTGOING_CALL_EXTRAS";
@@ -470,14 +468,6 @@ public class UIIntentsImpl extends UIIntents {
return getPendingIntentForConversationListActivity(context);
}
@Override
public Intent getWirelessAlertsIntent() {
final Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName(CMAS_COMPONENT, CELL_BROADCAST_LIST_ACTIVITY));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return intent;
}
@Override
public Intent getApnEditorIntent(final Context context, final String rowId, final int subId) {
final Intent intent = new Intent(context, ApnEditorActivity.class);

View File

@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -138,27 +139,6 @@ public class PerSubscriptionSettingsActivity extends BugleActionBarActivity {
getString(R.string.delivery_reports_pref_key));
advancedCategory.removePreference(deliveryReportsPref);
}
final Preference wirelessAlertPref = findPreference(getString(
R.string.wireless_alerts_key));
if (!isCellBroadcastAppLinkEnabled()) {
advancedCategory.removePreference(wirelessAlertPref);
} else {
wirelessAlertPref.setOnPreferenceClickListener(
new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(final Preference preference) {
try {
startActivity(UIIntents.get().getWirelessAlertsIntent());
} catch (final ActivityNotFoundException e) {
// Handle so we shouldn't crash if the wireless alerts
// implementation is broken.
LogUtil.e(LogUtil.BUGLE_TAG,
"Failed to launch wireless alerts activity", e);
}
return true;
}
});
}
// Access Point Names (APNs)
final PreferenceScreen apnsScreen =
@@ -196,20 +176,6 @@ public class PerSubscriptionSettingsActivity extends BugleActionBarActivity {
}
}
private boolean isCellBroadcastAppLinkEnabled() {
if (!MmsConfig.get(mSubId).getShowCellBroadcast()) {
return false;
}
try {
final PackageManager pm = getActivity().getPackageManager();
return pm.getApplicationEnabledSetting(UIIntents.CMAS_COMPONENT)
!= PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
} catch (final IllegalArgumentException ignored) {
// CMAS app not installed.
}
return false;
}
private void updateGroupMmsPrefSummary() {
final boolean groupMmsEnabled = getPreferenceScreen().getSharedPreferences().getBoolean(
mGroupMmsPrefKey, getResources().getBoolean(R.bool.group_mms_pref_default));