Add activity expose condition for Satellite messaging activity
In case carrier_enabled_satellite_flag or KEY_SATELLITE_ATTACH_SUPPORTED_BOOL is not supported, activity invocation intent will be ignored. Because the guidance description of the activity cause misunderstanding to users when the satellite feature is not set properly. Bug: 338377564 Test: manual test adb shell am start -a "android.settings.SATELLITE_SETTING" --ei sub_id (test sub id) for each key's enable/disable combination for KEY_SATELLITE_ATTACH_SUPPORTED_BOOL and carrier_enabled_satellite_flag (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:308ced3fc8e69378611ce333ed5f0e8337ff91fe) Change-Id: Ib5401f433f802e7aa74cc175179776deb576edfc
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.network.telephony;
|
package com.android.settings.network.telephony;
|
||||||
|
|
||||||
|
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL;
|
||||||
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_INFORMATION_REDIRECT_URL_STRING;
|
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_INFORMATION_REDIRECT_URL_STRING;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@@ -43,6 +44,7 @@ import androidx.annotation.Nullable;
|
|||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceCategory;
|
import androidx.preference.PreferenceCategory;
|
||||||
|
|
||||||
|
import com.android.internal.telephony.flags.Flags;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.dashboard.RestrictedDashboardFragment;
|
import com.android.settings.dashboard.RestrictedDashboardFragment;
|
||||||
import com.android.settingslib.HelpUtils;
|
import com.android.settingslib.HelpUtils;
|
||||||
@@ -82,12 +84,27 @@ public class SatelliteSetting extends RestrictedDashboardFragment {
|
|||||||
public void onCreate(@NonNull Bundle savedInstanceState) {
|
public void onCreate(@NonNull Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
// In case carrier roaming satellite is not supported, do nothing.
|
||||||
|
if (!Flags.carrierEnabledSatelliteFlag()) {
|
||||||
|
Log.d(TAG, "SatelliteSettings: satellite feature is not supported, do nothing.");
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mActivity = getActivity();
|
mActivity = getActivity();
|
||||||
mTelephonymanager = mActivity.getSystemService(TelephonyManager.class);
|
|
||||||
mCarrierConfigManager = mActivity.getSystemService(CarrierConfigManager.class);
|
|
||||||
mSatelliteManager = mActivity.getSystemService(SatelliteManager.class);
|
|
||||||
mSubId = mActivity.getIntent().getIntExtra(SUB_ID,
|
mSubId = mActivity.getIntent().getIntExtra(SUB_ID,
|
||||||
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
||||||
|
|
||||||
|
mCarrierConfigManager = mActivity.getSystemService(CarrierConfigManager.class);
|
||||||
|
if (!isSatelliteAttachSupported(mSubId)) {
|
||||||
|
Log.d(TAG, "SatelliteSettings: KEY_SATELLITE_ATTACH_SUPPORTED_BOOL is false, "
|
||||||
|
+ "do nothing.");
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mTelephonymanager = mActivity.getSystemService(TelephonyManager.class);
|
||||||
|
mSatelliteManager = mActivity.getSystemService(SatelliteManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -211,6 +228,16 @@ public class SatelliteSetting extends RestrictedDashboardFragment {
|
|||||||
return mConfigBundle.getString(KEY_SATELLITE_INFORMATION_REDIRECT_URL_STRING, "");
|
return mConfigBundle.getString(KEY_SATELLITE_INFORMATION_REDIRECT_URL_STRING, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isSatelliteAttachSupported(int subId) {
|
||||||
|
PersistableBundle bundle = mCarrierConfigManager.getConfigForSubId(subId,
|
||||||
|
KEY_SATELLITE_ATTACH_SUPPORTED_BOOL);
|
||||||
|
if (bundle.isEmpty()) {
|
||||||
|
Log.d(TAG, "SatelliteSettings: getDefaultConfig");
|
||||||
|
bundle = CarrierConfigManager.getDefaultConfig();
|
||||||
|
}
|
||||||
|
return bundle.getBoolean(KEY_SATELLITE_ATTACH_SUPPORTED_BOOL, false);
|
||||||
|
}
|
||||||
|
|
||||||
private static void loge(String message) {
|
private static void loge(String message) {
|
||||||
Log.e(TAG, message);
|
Log.e(TAG, message);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user