Files
app_Settings/src/com/android/settings/network/telephony/SatelliteSettingSosPreferenceController.java
tomhsu 90092e7da4 Create a Satellite SOS entry
- This is a entry to start Satellite SOS pagein mobile network page.

Flag: com.android.settings.flags.satellite_oem_settings_ux_migration
Fix: b/370509415
Test: atest pass
Change-Id: I3978513b15ad498b9b8ea298060d89fd35efc7ed
2024-11-29 07:19:36 +00:00

55 lines
2.0 KiB
Java

/*
* Copyright (C) 2024 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.network.telephony;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ESOS_SUPPORTED_BOOL;
import android.content.Context;
import android.os.PersistableBundle;
import com.android.settings.flags.Flags;
import com.android.settings.network.CarrierConfigCache;
/** A controller for Satellite SOS entry preference. */
public class SatelliteSettingSosPreferenceController extends TelephonyBasePreferenceController {
private static final String TAG = "SatelliteSettingSosPrefController";
public SatelliteSettingSosPreferenceController(Context context,
String preferenceKey) {
super(context, preferenceKey);
}
/** Setup the subscription Id for the UI with specific UI group. */
public void init(int subId) {
mSubId = subId;
}
@Override
public int getAvailabilityStatus(int subId) {
if (Flags.satelliteOemSettingsUxMigration()) {
CarrierConfigCache carrierConfigCache = CarrierConfigCache.getInstance(mContext);
PersistableBundle bundle = carrierConfigCache.getConfigForSubId(subId);
if (bundle == null) {
return CONDITIONALLY_UNAVAILABLE;
}
boolean isCarrierSupport = bundle.getBoolean(KEY_SATELLITE_ESOS_SUPPORTED_BOOL);
return isCarrierSupport ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
}
return CONDITIONALLY_UNAVAILABLE;
}
}