Snap for 7668007 from 8e98df31a4
to sc-qpr1-release
Change-Id: I4d63c9c2a1a595b4fdb6bcf674f8248efc8317ae
This commit is contained in:
@@ -273,10 +273,6 @@
|
||||
<action android:name="android.settings.WIFI_SETTINGS" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<intent-filter android:priority="1">
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="com.android.settings.SHORTCUT" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||
android:value="com.android.settings.wifi.WifiSettings" />
|
||||
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
|
||||
@@ -285,7 +281,7 @@
|
||||
|
||||
<activity
|
||||
android:name="Settings$NetworkProviderSettingsActivity"
|
||||
android:label="@string/network_dashboard_title"
|
||||
android:label="@string/provider_internet_settings"
|
||||
android:icon="@drawable/ic_homepage_network"
|
||||
android:exported="true"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize">
|
||||
|
@@ -13366,8 +13366,10 @@
|
||||
<string name="carrier_wifi_network_title">W+ network</string>
|
||||
<!-- Provider Model: title of SIM category -->
|
||||
<string name="sim_category_title">SIM</string>
|
||||
<!-- Provider Model: title of Downloaded category. [CHAR LIMIT=50] -->
|
||||
<!-- Provider Model: title of Downloaded SIM category. [CHAR LIMIT=50] -->
|
||||
<string name="downloaded_sim_category_title">DOWNLOADED SIM</string>
|
||||
<!-- Provider Model: title of Downloaded SIMs category. [CHAR LIMIT=50] -->
|
||||
<string name="downloaded_sims_category_title">DOWNLOADED SIMS</string>
|
||||
<!-- Provider Model: summary of Active in SIM category. [CHAR LIMIT=50] -->
|
||||
<string name="sim_category_active_sim">Active</string>
|
||||
<!-- Provider Model: summary of Inactive in SIM category. [CHAR LIMIT=50] -->
|
||||
|
@@ -24,6 +24,7 @@ import android.telephony.ServiceState;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.lifecycle.LifecycleObserver;
|
||||
@@ -44,12 +45,14 @@ public class NetworkProviderCallsSmsController extends AbstractPreferenceControl
|
||||
|
||||
private static final String TAG = "NetworkProviderCallsSmsController";
|
||||
private static final String KEY = "calls_and_sms";
|
||||
private static final String RTL_MARK = "\u200F";
|
||||
|
||||
private UserManager mUserManager;
|
||||
private SubscriptionManager mSubscriptionManager;
|
||||
private SubscriptionsChangeListener mSubscriptionsChangeListener;
|
||||
private TelephonyManager mTelephonyManager;
|
||||
private RestrictedPreference mPreference;
|
||||
private boolean mIsRtlMode;
|
||||
|
||||
/**
|
||||
* The summary text and click behavior of the "Calls & SMS" item on the
|
||||
@@ -61,6 +64,8 @@ public class NetworkProviderCallsSmsController extends AbstractPreferenceControl
|
||||
mUserManager = context.getSystemService(UserManager.class);
|
||||
mSubscriptionManager = context.getSystemService(SubscriptionManager.class);
|
||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
|
||||
mIsRtlMode = context.getResources().getConfiguration().getLayoutDirection()
|
||||
== View.LAYOUT_DIRECTION_RTL;
|
||||
if (lifecycle != null) {
|
||||
mSubscriptionsChangeListener = new SubscriptionsChangeListener(context, this);
|
||||
lifecycle.addObserver(this);
|
||||
@@ -121,6 +126,10 @@ public class NetworkProviderCallsSmsController extends AbstractPreferenceControl
|
||||
if (subInfo != subs.get(subs.size() - 1)) {
|
||||
summary.append(", ");
|
||||
}
|
||||
|
||||
if (mIsRtlMode) {
|
||||
summary.insert(0, RTL_MARK).insert(summary.length(), RTL_MARK);
|
||||
}
|
||||
}
|
||||
return summary;
|
||||
}
|
||||
@@ -152,12 +161,12 @@ public class NetworkProviderCallsSmsController extends AbstractPreferenceControl
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
protected int getDefaultVoiceSubscriptionId(){
|
||||
protected int getDefaultVoiceSubscriptionId() {
|
||||
return SubscriptionManager.getDefaultVoiceSubscriptionId();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
protected int getDefaultSmsSubscriptionId(){
|
||||
protected int getDefaultSmsSubscriptionId() {
|
||||
return SubscriptionManager.getDefaultSmsSubscriptionId();
|
||||
}
|
||||
|
||||
|
@@ -3,9 +3,11 @@ package com.android.settings.network;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceCategory;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.widget.PreferenceCategoryController;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||
@@ -15,6 +17,7 @@ public class NetworkProviderDownloadedSimsCategoryController extends
|
||||
|
||||
private static final String KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM =
|
||||
"provider_model_downloaded_sim_category";
|
||||
private PreferenceCategory mPreferenceCategory;
|
||||
private NetworkProviderDownloadedSimListController mNetworkProviderDownloadedSimListController;
|
||||
|
||||
public NetworkProviderDownloadedSimsCategoryController(Context context, String key) {
|
||||
@@ -44,9 +47,19 @@ public class NetworkProviderDownloadedSimsCategoryController extends
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
PreferenceCategory preferenceCategory = screen.findPreference(
|
||||
mPreferenceCategory = screen.findPreference(
|
||||
KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM);
|
||||
preferenceCategory.setVisible(isAvailable());
|
||||
mPreferenceCategory.setVisible(isAvailable());
|
||||
mNetworkProviderDownloadedSimListController.displayPreference(screen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
super.updateState(preference);
|
||||
int count = mPreferenceCategory.getPreferenceCount();
|
||||
String title = mContext.getString(count > 1
|
||||
? R.string.downloaded_sims_category_title
|
||||
: R.string.downloaded_sim_category_title);
|
||||
mPreferenceCategory.setTitle(title);
|
||||
}
|
||||
}
|
||||
|
@@ -710,6 +710,11 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
Log.i(TAG, "onWifiStateChanged called with wifi state: " + wifiState);
|
||||
}
|
||||
|
||||
if (isFinishingOrDestroyed()) {
|
||||
Log.w(TAG, "onWifiStateChanged shouldn't run when fragment is finishing or destroyed");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (wifiState) {
|
||||
case WifiManager.WIFI_STATE_ENABLED:
|
||||
updateWifiEntryPreferences();
|
||||
@@ -981,6 +986,11 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
|
||||
|
||||
private String getSavedNetworkSettingsSummaryText(
|
||||
int numSavedNetworks, int numSavedSubscriptions) {
|
||||
if (getResources() == null) {
|
||||
Log.w(TAG, "getSavedNetworkSettingsSummaryText shouldn't run if resource is not ready");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (numSavedSubscriptions == 0) {
|
||||
return getResources().getQuantityString(R.plurals.wifi_saved_access_points_summary,
|
||||
numSavedNetworks, numSavedNetworks);
|
||||
|
@@ -46,7 +46,7 @@ public class CallsDefaultSubscriptionController extends DefaultSubscriptionContr
|
||||
@Override
|
||||
public CharSequence getSummary() {
|
||||
if (Utils.isProviderModelEnabled(mContext)) {
|
||||
return MobileNetworkUtils.getPreferredStatus(mContext, mManager, true);
|
||||
return MobileNetworkUtils.getPreferredStatus(isRtlMode(), mContext, mManager, true);
|
||||
} else {
|
||||
return super.getSummary();
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import android.telecom.PhoneAccountHandle;
|
||||
import android.telecom.TelecomManager;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.lifecycle.LifecycleObserver;
|
||||
@@ -62,11 +63,14 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
|
||||
private static final ComponentName PSTN_CONNECTION_SERVICE_COMPONENT =
|
||||
new ComponentName("com.android.phone",
|
||||
"com.android.services.telephony.TelephonyConnectionService");
|
||||
private boolean mIsRtlMode;
|
||||
|
||||
public DefaultSubscriptionController(Context context, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
mManager = context.getSystemService(SubscriptionManager.class);
|
||||
mChangeListener = new SubscriptionsChangeListener(context, this);
|
||||
mIsRtlMode = context.getResources().getConfiguration().getLayoutDirection()
|
||||
== View.LAYOUT_DIRECTION_RTL;
|
||||
}
|
||||
|
||||
public void init(Lifecycle lifecycle) {
|
||||
@@ -285,4 +289,8 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
|
||||
refreshSummary(mPreference);
|
||||
}
|
||||
}
|
||||
|
||||
boolean isRtlMode() {
|
||||
return mIsRtlMode;
|
||||
}
|
||||
}
|
||||
|
@@ -99,6 +99,7 @@ public class MobileNetworkUtils {
|
||||
"esim.enable_esim_system_ui_by_default";
|
||||
private static final String LEGACY_ACTION_CONFIGURE_PHONE_ACCOUNT =
|
||||
"android.telecom.action.CONNECTION_SERVICE_CONFIGURE";
|
||||
private static final String RTL_MARK = "\u200F";
|
||||
|
||||
// The following constants are used to draw signal icon.
|
||||
public static final int NO_CELL_DATA_TYPE_ICON = 0;
|
||||
@@ -922,7 +923,7 @@ public class MobileNetworkUtils {
|
||||
/**
|
||||
* Returns preferred status of Calls & SMS separately when Provider Model is enabled.
|
||||
*/
|
||||
public static CharSequence getPreferredStatus(Context context,
|
||||
public static CharSequence getPreferredStatus(boolean isRtlMode, Context context,
|
||||
SubscriptionManager subscriptionManager, boolean isPreferredCallStatus) {
|
||||
final List<SubscriptionInfo> subs = SubscriptionUtil.getActiveSubscriptions(
|
||||
subscriptionManager);
|
||||
@@ -956,6 +957,10 @@ public class MobileNetworkUtils {
|
||||
if (subInfo != subs.get(subs.size() - 1)) {
|
||||
summary.append(", ");
|
||||
}
|
||||
|
||||
if (isRtlMode) {
|
||||
summary.insert(0, RTL_MARK).insert(summary.length(), RTL_MARK);
|
||||
}
|
||||
}
|
||||
return summary;
|
||||
} else {
|
||||
|
@@ -62,7 +62,7 @@ public class SmsDefaultSubscriptionController extends DefaultSubscriptionControl
|
||||
@Override
|
||||
public CharSequence getSummary() {
|
||||
if (Utils.isProviderModelEnabled(mContext)) {
|
||||
return MobileNetworkUtils.getPreferredStatus(mContext, mManager, false);
|
||||
return MobileNetworkUtils.getPreferredStatus(isRtlMode(), mContext, mManager, false);
|
||||
} else {
|
||||
return super.getSummary();
|
||||
}
|
||||
|
Reference in New Issue
Block a user