Snap for 12715656 from 8a995f3762 to 25Q1-release
Change-Id: I5845e2139daccfe07ab30013689873e27d2ccd72
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
[Hook Scripts]
|
[Hook Scripts]
|
||||||
checkcolor_hook = ${REPO_ROOT}/prebuilts/checkcolor/checkcolor.py -p .
|
# TODO(b/377902600): Re-enable this hook once it is fixed.
|
||||||
|
#checkcolor_hook = ${REPO_ROOT}/prebuilts/checkcolor/checkcolor.py -p .
|
||||||
|
|
||||||
checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT}
|
checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT}
|
||||||
|
|
||||||
|
|||||||
@@ -41,3 +41,14 @@ flag {
|
|||||||
description: "This flag controls whether the onboarding education settings UX should be enabled"
|
description: "This flag controls whether the onboarding education settings UX should be enabled"
|
||||||
bug: "370940762"
|
bug: "370940762"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flag {
|
||||||
|
name: "biometric_onboarding_education"
|
||||||
|
namespace: "biometrics_integration"
|
||||||
|
description: "This flag controls whether the onboarding education settings UX should be enabled"
|
||||||
|
bug: "370940762"
|
||||||
|
metadata {
|
||||||
|
purpose: PURPOSE_BUGFIX
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -470,6 +470,8 @@
|
|||||||
<string name="country_selection_title">Region preference</string>
|
<string name="country_selection_title">Region preference</string>
|
||||||
<!-- Hint text in a search edit box (used to filter long language / country lists) [CHAR LIMIT=25] -->
|
<!-- Hint text in a search edit box (used to filter long language / country lists) [CHAR LIMIT=25] -->
|
||||||
<string name="search_language_hint">Type language name</string>
|
<string name="search_language_hint">Type language name</string>
|
||||||
|
<!-- Category for more language settings. [CHAR LIMIT=NONE]-->
|
||||||
|
<string name="more_language_settings_category">More language settings</string>
|
||||||
|
|
||||||
<!-- Regional Preferences begin -->
|
<!-- Regional Preferences begin -->
|
||||||
<!-- The title of the menu entry of regional preferences. [CHAR LIMIT=50] -->
|
<!-- The title of the menu entry of regional preferences. [CHAR LIMIT=50] -->
|
||||||
@@ -3048,7 +3050,7 @@
|
|||||||
<!-- Dark UI screen footer action text linking to Modes settings. [CHAR LIMIT=NONE] -->
|
<!-- Dark UI screen footer action text linking to Modes settings. [CHAR LIMIT=NONE] -->
|
||||||
<string name="dark_ui_modes_footer_action">Modes settings</string>
|
<string name="dark_ui_modes_footer_action">Modes settings</string>
|
||||||
<!-- Even Dimmer setting title. Allows device to reduce brightness even further than standard range. [CHAR LIMIT=NONE] -->
|
<!-- Even Dimmer setting title. Allows device to reduce brightness even further than standard range. [CHAR LIMIT=NONE] -->
|
||||||
<string name="even_dimmer_display_title">Even dimmer</string>
|
<string name="even_dimmer_display_title">Extra dim</string>
|
||||||
<!-- Even Dimmer setting summary. [CHAR LIMIT=NONE] -->
|
<!-- Even Dimmer setting summary. [CHAR LIMIT=NONE] -->
|
||||||
<string name="even_dimmer_display_summary">Allow device to go dimmer than usual</string>
|
<string name="even_dimmer_display_summary">Allow device to go dimmer than usual</string>
|
||||||
|
|
||||||
@@ -12302,8 +12304,10 @@
|
|||||||
<string name="satellite_warning_dialog_title">Can’t turn on <xliff:g id="function" example="bluetooth">%1$s</xliff:g></string>
|
<string name="satellite_warning_dialog_title">Can’t turn on <xliff:g id="function" example="bluetooth">%1$s</xliff:g></string>
|
||||||
<!-- Content for satellite warning dialog to avoid user using wifi/bluetooth/airplane mode [CHAR_LIMIT=NONE] -->
|
<!-- Content for satellite warning dialog to avoid user using wifi/bluetooth/airplane mode [CHAR_LIMIT=NONE] -->
|
||||||
<string name="satellite_warning_dialog_content">To turn on <xliff:g id="function" example="bluetooth">%1$s</xliff:g>, first end the satellite connection</string>
|
<string name="satellite_warning_dialog_content">To turn on <xliff:g id="function" example="bluetooth">%1$s</xliff:g>, first end the satellite connection</string>
|
||||||
<!-- Category title for satellite functions in mobile network settings [CHAR LIMIT=60] -->
|
<!-- Category title for satellite functions with data transmission in mobile network settings [CHAR LIMIT=60] -->
|
||||||
<string name="category_title_satellite_connectivity">Satellite connectivity</string>
|
<string name="category_title_satellite_connectivity">Satellite connectivity</string>
|
||||||
|
<!-- Title for satellite functions with data transmission in mobile network settings [CHAR LIMIT=60] -->
|
||||||
|
<string name="satellite_setting_connectivity">Satellite connectivity</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- Title for Apn settings in mobile network settings [CHAR LIMIT=60] -->
|
<!-- Title for Apn settings in mobile network settings [CHAR LIMIT=60] -->
|
||||||
|
|||||||
@@ -28,12 +28,13 @@
|
|||||||
android:title="@string/system_language"
|
android:title="@string/system_language"
|
||||||
android:fragment="com.android.settings.localepicker.LocaleListEditor"
|
android:fragment="com.android.settings.localepicker.LocaleListEditor"
|
||||||
settings:controller="com.android.settings.language.PhoneLanguagePreferenceController" />
|
settings:controller="com.android.settings.language.PhoneLanguagePreferenceController" />
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="apps_language"
|
android:key="apps_language"
|
||||||
android:title="@string/app_locales_picker_menu_title"
|
android:title="@string/app_locales_picker_menu_title"
|
||||||
android:summary="@string/app_locale_picker_summary"
|
android:summary="@string/app_locale_picker_summary"
|
||||||
android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
|
android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
|
||||||
settings:controller="com.android.settings.applications.appinfo.ManageAppLocalePreferenceController">
|
settings:controller="com.android.settings.applications.appinfo.AppsLocalePreferenceController">
|
||||||
<extra
|
<extra
|
||||||
android:name="classname"
|
android:name="classname"
|
||||||
android:value="com.android.settings.applications.appinfo.AppLocaleDetails" />
|
android:value="com.android.settings.applications.appinfo.AppLocaleDetails" />
|
||||||
@@ -48,6 +49,22 @@
|
|||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="more_language_settings_category"
|
||||||
|
android:title="@string/more_language_settings_category"
|
||||||
|
settings:controller="com.android.settings.language.MoreLanguagesSettingsCategoryController">
|
||||||
|
<Preference
|
||||||
|
android:key="apps_language_in_more_language_settings"
|
||||||
|
android:title="@string/app_locales_picker_menu_title"
|
||||||
|
android:summary="@string/app_locale_picker_summary"
|
||||||
|
android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
|
||||||
|
settings:controller="com.android.settings.applications.appinfo.NewAppsLocalePreferenceController">
|
||||||
|
<extra
|
||||||
|
android:name="classname"
|
||||||
|
android:value="com.android.settings.applications.appinfo.AppLocaleDetails" />
|
||||||
|
</Preference>
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="regional_preferences_category"
|
android:key="regional_preferences_category"
|
||||||
android:title="@string/regional_preferences_category_title"
|
android:title="@string/regional_preferences_category_title"
|
||||||
|
|||||||
@@ -206,7 +206,7 @@
|
|||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="telephony_satellite_settings_category_key"
|
android:key="telephony_satellite_settings_category_key"
|
||||||
android:title="@string/category_title_satellite_connectivity"
|
android:title="@string/satellite_setting_title"
|
||||||
settings:controller="com.android.settings.network.telephony.SatelliteSettingsPreferenceCategoryController">
|
settings:controller="com.android.settings.network.telephony.SatelliteSettingsPreferenceCategoryController">
|
||||||
|
|
||||||
<com.android.settingslib.RestrictedPreference
|
<com.android.settingslib.RestrictedPreference
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# See system/core/logcat/event.logtags for a description of the format of this file.
|
# See system/logging/logcat/event.logtags for a description of the format of this file.
|
||||||
|
|
||||||
option java_package com.android.settings
|
option java_package com.android.settings
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* 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.applications.appinfo;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.android.settings.core.BasePreferenceController;
|
||||||
|
import com.android.settings.flags.Flags;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A controller to update current locale information of application
|
||||||
|
* and a entry to launch {@link ManageApplications}.
|
||||||
|
*/
|
||||||
|
public class AppsLocalePreferenceController extends BasePreferenceController {
|
||||||
|
public AppsLocalePreferenceController(@NonNull Context context, @NonNull String key) {
|
||||||
|
super(context, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAvailabilityStatus() {
|
||||||
|
if (!Flags.regionalPreferencesApiEnabled()) {
|
||||||
|
return AVAILABLE;
|
||||||
|
}
|
||||||
|
return CONDITIONALLY_UNAVAILABLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* 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.applications.appinfo;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.android.settings.core.BasePreferenceController;
|
||||||
|
import com.android.settings.flags.Flags;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A controller to update current locale information of application
|
||||||
|
* and a entry to launch {@link ManageApplications}.
|
||||||
|
*/
|
||||||
|
public class NewAppsLocalePreferenceController extends BasePreferenceController {
|
||||||
|
|
||||||
|
public NewAppsLocalePreferenceController(@NonNull Context context, @NonNull String key) {
|
||||||
|
super(context, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAvailabilityStatus() {
|
||||||
|
// TODO(b/381011808) After feature release, this class may be renamed.
|
||||||
|
if (Flags.regionalPreferencesApiEnabled()) {
|
||||||
|
return AVAILABLE;
|
||||||
|
}
|
||||||
|
return CONDITIONALLY_UNAVAILABLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@ package com.android.settings.bluetooth;
|
|||||||
|
|
||||||
import static android.bluetooth.BluetoothDevice.METADATA_MODEL_NAME;
|
import static android.bluetooth.BluetoothDevice.METADATA_MODEL_NAME;
|
||||||
|
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.bluetooth.BluetoothDevice;
|
import android.bluetooth.BluetoothDevice;
|
||||||
import android.bluetooth.BluetoothProfile;
|
import android.bluetooth.BluetoothProfile;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -83,6 +84,8 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
|
|||||||
private static final boolean LE_AUDIO_TOGGLE_VISIBLE_DEFAULT_VALUE = true;
|
private static final boolean LE_AUDIO_TOGGLE_VISIBLE_DEFAULT_VALUE = true;
|
||||||
private static final String LE_AUDIO_TOGGLE_VISIBLE_PROPERTY =
|
private static final String LE_AUDIO_TOGGLE_VISIBLE_PROPERTY =
|
||||||
"persist.bluetooth.leaudio.toggle_visible";
|
"persist.bluetooth.leaudio.toggle_visible";
|
||||||
|
private static final String BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY =
|
||||||
|
"persist.bluetooth.leaudio.bypass_allow_list";
|
||||||
|
|
||||||
private Set<String> mInvisibleProfiles = Collections.emptySet();
|
private Set<String> mInvisibleProfiles = Collections.emptySet();
|
||||||
private final AtomicReference<Set<String>> mAdditionalInvisibleProfiles =
|
private final AtomicReference<Set<String>> mAdditionalInvisibleProfiles =
|
||||||
@@ -378,6 +381,16 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isCurrentDeviceInOrByPassAllowList() {
|
||||||
|
if (!SystemProperties.getBoolean(LE_AUDIO_CONNECTION_BY_DEFAULT_PROPERTY, true)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return SystemProperties.getBoolean(BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY, false)
|
||||||
|
|| isModelNameInAllowList(
|
||||||
|
BluetoothUtils.getStringMetaData(
|
||||||
|
mCachedDevice.getDevice(), METADATA_MODEL_NAME));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable the Le Audio profile for each of the Le Audio devices.
|
* Disable the Le Audio profile for each of the Le Audio devices.
|
||||||
*
|
*
|
||||||
@@ -389,6 +402,11 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mMetricsFeatureProvider.action(
|
||||||
|
mContext,
|
||||||
|
SettingsEnums.ACTION_BLUETOOTH_PROFILE_LE_AUDIO_OFF,
|
||||||
|
isCurrentDeviceInOrByPassAllowList());
|
||||||
|
|
||||||
LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile();
|
LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile();
|
||||||
LocalBluetoothProfile broadcastAssistant =
|
LocalBluetoothProfile broadcastAssistant =
|
||||||
mProfileManager.getLeAudioBroadcastAssistantProfile();
|
mProfileManager.getLeAudioBroadcastAssistantProfile();
|
||||||
@@ -427,6 +445,11 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mMetricsFeatureProvider.action(
|
||||||
|
mContext,
|
||||||
|
SettingsEnums.ACTION_BLUETOOTH_PROFILE_LE_AUDIO_ON,
|
||||||
|
isCurrentDeviceInOrByPassAllowList());
|
||||||
|
|
||||||
if (!SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false)) {
|
if (!SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false)) {
|
||||||
Log.i(TAG, "Disabling classic audio profiles because dual mode is disabled");
|
Log.i(TAG, "Disabling classic audio profiles because dual mode is disabled");
|
||||||
disableProfileBeforeUserEnablesLeAudio(mProfileManager.getA2dpProfile());
|
disableProfileBeforeUserEnablesLeAudio(mProfileManager.getA2dpProfile());
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* 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.language;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.android.settings.flags.Flags;
|
||||||
|
import com.android.settings.widget.PreferenceCategoryController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller for the "More language settings" category in the Language & region settings.
|
||||||
|
*/
|
||||||
|
public class MoreLanguagesSettingsCategoryController extends PreferenceCategoryController {
|
||||||
|
|
||||||
|
public MoreLanguagesSettingsCategoryController(@NonNull Context context, @NonNull String key) {
|
||||||
|
super(context, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getAvailabilityStatus() {
|
||||||
|
if (Flags.regionalPreferencesApiEnabled()) {
|
||||||
|
return AVAILABLE;
|
||||||
|
}
|
||||||
|
return CONDITIONALLY_UNAVAILABLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -86,6 +86,7 @@ public class SatelliteSettingPreferenceController extends
|
|||||||
@Override
|
@Override
|
||||||
public void displayPreference(@NonNull PreferenceScreen screen) {
|
public void displayPreference(@NonNull PreferenceScreen screen) {
|
||||||
super.displayPreference(screen);
|
super.displayPreference(screen);
|
||||||
|
updateState(screen.findPreference(getPreferenceKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,55 +16,120 @@
|
|||||||
|
|
||||||
package com.android.settings.network.telephony;
|
package com.android.settings.network.telephony;
|
||||||
|
|
||||||
|
import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_DATA;
|
||||||
|
import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_SMS;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.PersistableBundle;
|
import android.telephony.TelephonyCallback;
|
||||||
import android.telephony.CarrierConfigManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.telephony.satellite.SatelliteManager;
|
import android.telephony.satellite.NtnSignalStrength;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.internal.telephony.flags.Flags;
|
import androidx.annotation.NonNull;
|
||||||
import com.android.settings.network.CarrierConfigCache;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
import androidx.lifecycle.DefaultLifecycleObserver;
|
||||||
|
import androidx.lifecycle.LifecycleOwner;
|
||||||
|
import androidx.preference.PreferenceCategory;
|
||||||
|
import androidx.preference.PreferenceScreen;
|
||||||
|
|
||||||
/** Preference controller for Satellite functions in mobile network settings.*/
|
import com.android.settings.R;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/** Preference controller for Satellite functions in mobile network settings. */
|
||||||
public class SatelliteSettingsPreferenceCategoryController
|
public class SatelliteSettingsPreferenceCategoryController
|
||||||
extends TelephonyBasePreferenceController {
|
extends TelephonyBasePreferenceController implements DefaultLifecycleObserver {
|
||||||
private static final String TAG = "SatelliteSettingsPrefCategoryCon";
|
private static final String TAG = "SatelliteSettingsPrefCategoryCon";
|
||||||
|
|
||||||
private CarrierConfigCache mCarrierConfigCache;
|
private PreferenceCategory mPreferenceCategory;
|
||||||
private SatelliteManager mSatelliteManager;
|
private TelephonyManager mTelephonyManager = null;
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
final CarrierRoamingNtnModeCallback mCarrierRoamingNtnModeCallback =
|
||||||
|
new CarrierRoamingNtnModeCallback();
|
||||||
|
|
||||||
public SatelliteSettingsPreferenceCategoryController(Context context, String key) {
|
public SatelliteSettingsPreferenceCategoryController(Context context, String key) {
|
||||||
super(context, key);
|
super(context, key);
|
||||||
mCarrierConfigCache = CarrierConfigCache.getInstance(context);
|
setAvailabilityStatus(UNSUPPORTED_ON_DEVICE);
|
||||||
mSatelliteManager = context.getSystemService(SatelliteManager.class);
|
mTelephonyManager = context.getSystemService(TelephonyManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set subId for Satellite Settings category .
|
* Set subId for Satellite Settings category .
|
||||||
|
*
|
||||||
* @param subId subscription ID.
|
* @param subId subscription ID.
|
||||||
*/
|
*/
|
||||||
public void init(int subId) {
|
public void init(int subId) {
|
||||||
Log.d(TAG, "init(), subId=" + subId);
|
Log.d(TAG, "init(), subId=" + subId);
|
||||||
mSubId = subId;
|
mSubId = subId;
|
||||||
|
mTelephonyManager = mTelephonyManager.createForSubscriptionId(subId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void displayPreference(PreferenceScreen screen) {
|
||||||
|
super.displayPreference(screen);
|
||||||
|
mPreferenceCategory = screen.findPreference(getPreferenceKey());
|
||||||
|
if (mPreferenceCategory.getPreferenceCount() > 0) {
|
||||||
|
for (int i = 0; i < mPreferenceCategory.getPreferenceCount(); i++) {
|
||||||
|
if (mPreferenceCategory.getPreference(i).isVisible()) {
|
||||||
|
setAvailabilityStatus(AVAILABLE_UNSEARCHABLE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus(int subId) {
|
public int getAvailabilityStatus(int subId) {
|
||||||
if (!Flags.carrierEnabledSatelliteFlag()) {
|
return isAvailable() ? AVAILABLE_UNSEARCHABLE : UNSUPPORTED_ON_DEVICE;
|
||||||
Log.d(TAG, "getAvailabilityStatus(" + subId + ") : carrierEnabledSatelliteFlag "
|
|
||||||
+ "is disabled");
|
|
||||||
return UNSUPPORTED_ON_DEVICE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mSatelliteManager == null) {
|
@Override
|
||||||
Log.d(TAG, "getAvailabilityStatus(" + subId + ") : SatelliteManager is null");
|
public void onResume(@NonNull LifecycleOwner owner) {
|
||||||
return UNSUPPORTED_ON_DEVICE;
|
mTelephonyManager.registerTelephonyCallback(mContext.getMainExecutor(),
|
||||||
|
mCarrierRoamingNtnModeCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
final PersistableBundle carrierConfig = mCarrierConfigCache.getConfigForSubId(subId);
|
@Override
|
||||||
final boolean isSatelliteAttachSupported = carrierConfig.getBoolean(
|
public void onPause(@NonNull LifecycleOwner owner) {
|
||||||
CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL);
|
mTelephonyManager.unregisterTelephonyCallback(mCarrierRoamingNtnModeCallback);
|
||||||
|
}
|
||||||
|
|
||||||
return isSatelliteAttachSupported ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
@VisibleForTesting
|
||||||
|
class CarrierRoamingNtnModeCallback extends TelephonyCallback implements
|
||||||
|
TelephonyCallback.CarrierRoamingNtnModeListener {
|
||||||
|
@Override
|
||||||
|
public void onCarrierRoamingNtnAvailableServicesChanged(List<Integer> availableServices) {
|
||||||
|
CarrierRoamingNtnModeListener.super.onCarrierRoamingNtnAvailableServicesChanged(
|
||||||
|
availableServices);
|
||||||
|
boolean isSmsAvailable = availableServices.contains(SERVICE_TYPE_SMS);
|
||||||
|
boolean isDataAvailable = availableServices.contains(SERVICE_TYPE_DATA);
|
||||||
|
Log.i(TAG, "isSmsAvailable : " + isSmsAvailable
|
||||||
|
+ " / isDataAvailable " + isDataAvailable);
|
||||||
|
if (mPreferenceCategory == null) {
|
||||||
|
Log.d(TAG, "Satellite preference category is not initialized yet");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isDataAvailable) {
|
||||||
|
mPreferenceCategory.setTitle(R.string.category_title_satellite_connectivity);
|
||||||
|
} else if (isSmsAvailable) {
|
||||||
|
mPreferenceCategory.setTitle(R.string.satellite_setting_title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCarrierRoamingNtnEligibleStateChanged(boolean eligible) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCarrierRoamingNtnModeChanged(boolean active) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCarrierRoamingNtnSignalStrengthChanged(NtnSignalStrength ntnSignalStrength) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,38 +16,37 @@
|
|||||||
|
|
||||||
package com.android.settings.network.telephony;
|
package com.android.settings.network.telephony;
|
||||||
|
|
||||||
import static com.android.settings.core.BasePreferenceController.AVAILABLE;
|
import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_DATA;
|
||||||
import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
|
import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_SMS;
|
||||||
|
|
||||||
|
import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
|
||||||
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
|
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.PersistableBundle;
|
|
||||||
import android.platform.test.annotations.DisableFlags;
|
|
||||||
import android.platform.test.annotations.EnableFlags;
|
|
||||||
import android.platform.test.flag.junit.SetFlagsRule;
|
|
||||||
import android.telephony.CarrierConfigManager;
|
|
||||||
import android.telephony.satellite.SatelliteManager;
|
|
||||||
|
|
||||||
|
import androidx.preference.Preference;
|
||||||
|
import androidx.preference.PreferenceCategory;
|
||||||
|
import androidx.preference.PreferenceManager;
|
||||||
|
import androidx.preference.PreferenceScreen;
|
||||||
import androidx.test.core.app.ApplicationProvider;
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
|
|
||||||
import com.android.internal.telephony.flags.Flags;
|
import com.android.settings.R;
|
||||||
import com.android.settings.network.CarrierConfigCache;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mock;
|
|
||||||
import org.mockito.junit.MockitoJUnit;
|
import org.mockito.junit.MockitoJUnit;
|
||||||
import org.mockito.junit.MockitoRule;
|
import org.mockito.junit.MockitoRule;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class SatelliteSettingsPreferenceCategoryControllerTest {
|
public class SatelliteSettingsPreferenceCategoryControllerTest {
|
||||||
private static final String KEY = "key";
|
private static final String KEY = "key";
|
||||||
@@ -55,16 +54,9 @@ public class SatelliteSettingsPreferenceCategoryControllerTest {
|
|||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public final MockitoRule mMockitoRule = MockitoJUnit.rule();
|
public final MockitoRule mMockitoRule = MockitoJUnit.rule();
|
||||||
@Rule
|
|
||||||
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
|
||||||
|
|
||||||
@Mock
|
|
||||||
private CarrierConfigCache mCarrierConfigCache;
|
|
||||||
|
|
||||||
private Context mContext = null;
|
private Context mContext = null;
|
||||||
private SatelliteManager mSatelliteManager = null;
|
|
||||||
private SatelliteSettingsPreferenceCategoryController mController = null;
|
private SatelliteSettingsPreferenceCategoryController mController = null;
|
||||||
private PersistableBundle mCarrierConfig = new PersistableBundle();
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
@@ -72,25 +64,38 @@ public class SatelliteSettingsPreferenceCategoryControllerTest {
|
|||||||
Looper.prepare();
|
Looper.prepare();
|
||||||
}
|
}
|
||||||
mContext = spy(ApplicationProvider.getApplicationContext());
|
mContext = spy(ApplicationProvider.getApplicationContext());
|
||||||
mSatelliteManager = new SatelliteManager(mContext);
|
|
||||||
CarrierConfigCache.setTestInstance(mContext, mCarrierConfigCache);
|
|
||||||
when(mContext.getSystemService(SatelliteManager.class)).thenReturn(mSatelliteManager);
|
|
||||||
mController = new SatelliteSettingsPreferenceCategoryController(mContext, KEY);
|
mController = new SatelliteSettingsPreferenceCategoryController(mContext, KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG)
|
public void getAvailabilityStatus_default_returnUnsupported() {
|
||||||
public void getAvailabilityStatus_featureDisabled_returnUnsupport() {
|
|
||||||
int result = mController.getAvailabilityStatus(TEST_SUB_ID);
|
int result = mController.getAvailabilityStatus(TEST_SUB_ID);
|
||||||
|
|
||||||
assertThat(result).isEqualTo(UNSUPPORTED_ON_DEVICE);
|
assertThat(result).isEqualTo(UNSUPPORTED_ON_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@EnableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG)
|
public void getAvailabilityStatus_hasAvailablePreference_returnAvailableUnsearchable() {
|
||||||
public void getAvailabilityStatus_noSatellite_returnUnsupport() {
|
PreferenceManager preferenceManager = new PreferenceManager(mContext);
|
||||||
when(mContext.getSystemService(SatelliteManager.class)).thenReturn(null);
|
PreferenceScreen preferenceScreen = preferenceManager.createPreferenceScreen(mContext);
|
||||||
mController = new SatelliteSettingsPreferenceCategoryController(mContext, KEY);
|
PreferenceCategory preferenceCategory = new PreferenceCategory(mContext);
|
||||||
|
preferenceCategory.setKey(KEY);
|
||||||
|
preferenceScreen.addPreference(preferenceCategory);
|
||||||
|
preferenceCategory.addPreference(new Preference(mContext));
|
||||||
|
mController.displayPreference(preferenceScreen);
|
||||||
|
|
||||||
|
int result = mController.getAvailabilityStatus(TEST_SUB_ID);
|
||||||
|
|
||||||
|
assertThat(result).isEqualTo(AVAILABLE_UNSEARCHABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getAvailabilityStatus_noAvailablePreference_returnUnsupported() {
|
||||||
|
PreferenceManager preferenceManager = new PreferenceManager(mContext);
|
||||||
|
PreferenceScreen preferenceScreen = preferenceManager.createPreferenceScreen(mContext);
|
||||||
|
PreferenceCategory preferenceCategory = new PreferenceCategory(mContext);
|
||||||
|
preferenceCategory.setKey(KEY);
|
||||||
|
preferenceScreen.addPreference(preferenceCategory);
|
||||||
|
mController.displayPreference(preferenceScreen);
|
||||||
|
|
||||||
int result = mController.getAvailabilityStatus(TEST_SUB_ID);
|
int result = mController.getAvailabilityStatus(TEST_SUB_ID);
|
||||||
|
|
||||||
@@ -98,30 +103,37 @@ public class SatelliteSettingsPreferenceCategoryControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@EnableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG)
|
public void setPreferenceTitle_hasDataService_showConnectivity() {
|
||||||
public void getAvailabilityStatus_carrierIsNotSupport_returnUnavailable() {
|
PreferenceManager preferenceManager = new PreferenceManager(mContext);
|
||||||
when(mContext.getSystemService(SatelliteManager.class)).thenReturn(null);
|
PreferenceScreen preferenceScreen = preferenceManager.createPreferenceScreen(mContext);
|
||||||
mCarrierConfig.putBoolean(
|
PreferenceCategory preferenceCategory = new PreferenceCategory(mContext);
|
||||||
CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
|
preferenceCategory.setKey(KEY);
|
||||||
false);
|
preferenceScreen.addPreference(preferenceCategory);
|
||||||
when(mCarrierConfigCache.getConfigForSubId(TEST_SUB_ID)).thenReturn(mCarrierConfig);
|
preferenceCategory.addPreference(new Preference(mContext));
|
||||||
|
mController.displayPreference(preferenceScreen);
|
||||||
|
|
||||||
int result = mController.getAvailabilityStatus(TEST_SUB_ID);
|
mController.mCarrierRoamingNtnModeCallback.onCarrierRoamingNtnAvailableServicesChanged(
|
||||||
|
List.of(SERVICE_TYPE_DATA));
|
||||||
|
|
||||||
assertThat(result).isEqualTo(CONDITIONALLY_UNAVAILABLE);
|
assertThat(preferenceCategory.getTitle()).isEqualTo(
|
||||||
|
mContext.getString(R.string.satellite_setting_connectivity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@EnableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG)
|
public void setPreferenceTitle_hasSmsService_showMessaging() {
|
||||||
public void getAvailabilityStatus_carrierIsSupport_returnAvailable() {
|
PreferenceManager preferenceManager = new PreferenceManager(mContext);
|
||||||
when(mContext.getSystemService(SatelliteManager.class)).thenReturn(null);
|
PreferenceScreen preferenceScreen = preferenceManager.createPreferenceScreen(mContext);
|
||||||
mCarrierConfig.putBoolean(
|
PreferenceCategory preferenceCategory = new PreferenceCategory(mContext);
|
||||||
CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
|
preferenceCategory.setKey(KEY);
|
||||||
true);
|
preferenceScreen.addPreference(preferenceCategory);
|
||||||
when(mCarrierConfigCache.getConfigForSubId(TEST_SUB_ID)).thenReturn(mCarrierConfig);
|
preferenceCategory.addPreference(new Preference(mContext));
|
||||||
|
mController.displayPreference(preferenceScreen);
|
||||||
|
|
||||||
int result = mController.getAvailabilityStatus(TEST_SUB_ID);
|
mController.mCarrierRoamingNtnModeCallback.onCarrierRoamingNtnAvailableServicesChanged(
|
||||||
|
List.of(SERVICE_TYPE_SMS));
|
||||||
|
|
||||||
assertThat(result).isEqualTo(AVAILABLE);
|
assertThat(preferenceCategory.getTitle()).isEqualTo(
|
||||||
|
mContext.getString(R.string.satellite_setting_title));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user