Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90092e7d authored by tomhsu's avatar tomhsu
Browse files

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
parent 01043fdf
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -12273,7 +12273,7 @@
    <!-- Summary for _satellite_setting_preference_layout. [CHAR LIMIT=NONE]-->
    <string name="satellite_setting_disabled_summary">Send and receive text messages by satellite. Not included with your account.</string>
    <!-- Search keywords for "_satellite_setting_preference_layout" [CHAR_LIMIT=NONE] -->
    <string name="keywords_satellite_setting">Satellite messaging</string>
    <string name="keywords_satellite_setting">Satellite messaging, satellite connectivity</string>
    <!-- Category name "About satellite messaging" [CHAR_LIMIT=NONE] -->
    <string name="category_name_about_satellite_messaging">About <xliff:g id="subject" example="satellite messaging">%1$s</xliff:g></string>
    <!-- Summary for category "About satellite messaging" [CHAR_LIMIT=NONE] -->
@@ -12314,6 +12314,12 @@
    <string name="description_satellite_setting_messaging">satellite messaging</string>
    <!-- Title for notifying user's account be able to use data transmission of Satellite" [CHAR_LIMIT=NONE] -->
    <string name="title_have_satellite_data_plan">Use of data is included with your account</string>
    <!-- Title for the entry of Satellite SOS [CHAR_LIMIT=NONE] -->
    <string name="title_for_satellite_sos_entry">Satellite SOS</string>
    <!-- Summary for the entry of Satellite SOS [CHAR_LIMIT=NONE] -->
    <string name="summary_for_satellite_sos_entry">Message with emergency services when you can\u2019t connect to a mobile or Wi\u2011Fi network</string>
    <!-- Keywords for the entry of Satellite SOS [CHAR_LIMIT=NONE] -->
    <string name="keywords_satellite_sos">satellite sos, sos</string>
+10 −0
Original line number Diff line number Diff line
@@ -217,6 +217,16 @@
                settings:controller=
                    "com.android.settings.network.telephony.SatelliteSettingPreferenceController"/>

            <com.android.settingslib.RestrictedPreference
                android:key="telephony_satellite_setting_sos_key"
                android:persistent="false"
                android:title="@string/title_for_satellite_sos_entry"
                android:summary="@string/summary_for_satellite_sos_entry"
                settings:keywords="@string/keywords_satellite_setting"
                settings:fragment="com.android.settings.network.telephony.SatelliteSettingsSosFragment"
                settings:controller=
                    "com.android.settings.network.telephony.SatelliteSettingSosPreferenceController"/>

        </PreferenceCategory>

        <PreferenceCategory
+5 −0
Original line number Diff line number Diff line
@@ -288,6 +288,11 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings impleme
        if (satelliteSettingPreferenceController != null) {
            satelliteSettingPreferenceController.init(mSubId);
        }
        final SatelliteSettingSosPreferenceController satelliteSettingSosPreferenceController = use(
                SatelliteSettingSosPreferenceController.class);
        if (satelliteSettingSosPreferenceController != null) {
            satelliteSettingSosPreferenceController.init(mSubId);
        }
        use(ApnPreferenceController.class).init(mSubId);
        use(CarrierPreferenceController.class).init(mSubId);
        use(DataUsagePreferenceController.class).init(mSubId);
+54 −0
Original line number Diff line number Diff line
/*
 * 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;
    }
}
+26 −0
Original line number Diff line number Diff line
/*
 * 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 com.android.settings.SettingsPreferenceFragment;

public class SatelliteSettingsSosFragment  extends SettingsPreferenceFragment {
    @Override
    public int getMetricsCategory() {
        return 0;
    }
}
Loading