Snap for 7668007 from 8e98df31a4 to sc-qpr1-release

Change-Id: I4d63c9c2a1a595b4fdb6bcf674f8248efc8317ae
This commit is contained in:
Android Build Coastguard Worker
2021-08-24 01:08:20 +00:00
9 changed files with 56 additions and 13 deletions

View File

@@ -273,10 +273,6 @@
<action android:name="android.settings.WIFI_SETTINGS" /> <action android:name="android.settings.WIFI_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </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" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.wifi.WifiSettings" /> android:value="com.android.settings.wifi.WifiSettings" />
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED" <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
@@ -285,7 +281,7 @@
<activity <activity
android:name="Settings$NetworkProviderSettingsActivity" android:name="Settings$NetworkProviderSettingsActivity"
android:label="@string/network_dashboard_title" android:label="@string/provider_internet_settings"
android:icon="@drawable/ic_homepage_network" android:icon="@drawable/ic_homepage_network"
android:exported="true" android:exported="true"
android:configChanges="orientation|keyboardHidden|screenSize"> android:configChanges="orientation|keyboardHidden|screenSize">

View File

@@ -13366,8 +13366,10 @@
<string name="carrier_wifi_network_title">W+ network</string> <string name="carrier_wifi_network_title">W+ network</string>
<!-- Provider Model: title of SIM category --> <!-- Provider Model: title of SIM category -->
<string name="sim_category_title">SIM</string> <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> <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] --> <!-- Provider Model: summary of Active in SIM category. [CHAR LIMIT=50] -->
<string name="sim_category_active_sim">Active</string> <string name="sim_category_active_sim">Active</string>
<!-- Provider Model: summary of Inactive in SIM category. [CHAR LIMIT=50] --> <!-- Provider Model: summary of Inactive in SIM category. [CHAR LIMIT=50] -->

View File

@@ -24,6 +24,7 @@ import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.view.View;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.lifecycle.LifecycleObserver; import androidx.lifecycle.LifecycleObserver;
@@ -44,12 +45,14 @@ public class NetworkProviderCallsSmsController extends AbstractPreferenceControl
private static final String TAG = "NetworkProviderCallsSmsController"; private static final String TAG = "NetworkProviderCallsSmsController";
private static final String KEY = "calls_and_sms"; private static final String KEY = "calls_and_sms";
private static final String RTL_MARK = "\u200F";
private UserManager mUserManager; private UserManager mUserManager;
private SubscriptionManager mSubscriptionManager; private SubscriptionManager mSubscriptionManager;
private SubscriptionsChangeListener mSubscriptionsChangeListener; private SubscriptionsChangeListener mSubscriptionsChangeListener;
private TelephonyManager mTelephonyManager; private TelephonyManager mTelephonyManager;
private RestrictedPreference mPreference; private RestrictedPreference mPreference;
private boolean mIsRtlMode;
/** /**
* The summary text and click behavior of the "Calls & SMS" item on the * 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); mUserManager = context.getSystemService(UserManager.class);
mSubscriptionManager = context.getSystemService(SubscriptionManager.class); mSubscriptionManager = context.getSystemService(SubscriptionManager.class);
mTelephonyManager = mContext.getSystemService(TelephonyManager.class); mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
mIsRtlMode = context.getResources().getConfiguration().getLayoutDirection()
== View.LAYOUT_DIRECTION_RTL;
if (lifecycle != null) { if (lifecycle != null) {
mSubscriptionsChangeListener = new SubscriptionsChangeListener(context, this); mSubscriptionsChangeListener = new SubscriptionsChangeListener(context, this);
lifecycle.addObserver(this); lifecycle.addObserver(this);
@@ -121,6 +126,10 @@ public class NetworkProviderCallsSmsController extends AbstractPreferenceControl
if (subInfo != subs.get(subs.size() - 1)) { if (subInfo != subs.get(subs.size() - 1)) {
summary.append(", "); summary.append(", ");
} }
if (mIsRtlMode) {
summary.insert(0, RTL_MARK).insert(summary.length(), RTL_MARK);
}
} }
return summary; return summary;
} }
@@ -152,12 +161,12 @@ public class NetworkProviderCallsSmsController extends AbstractPreferenceControl
} }
@VisibleForTesting @VisibleForTesting
protected int getDefaultVoiceSubscriptionId(){ protected int getDefaultVoiceSubscriptionId() {
return SubscriptionManager.getDefaultVoiceSubscriptionId(); return SubscriptionManager.getDefaultVoiceSubscriptionId();
} }
@VisibleForTesting @VisibleForTesting
protected int getDefaultSmsSubscriptionId(){ protected int getDefaultSmsSubscriptionId() {
return SubscriptionManager.getDefaultSmsSubscriptionId(); return SubscriptionManager.getDefaultSmsSubscriptionId();
} }

View File

@@ -3,9 +3,11 @@ package com.android.settings.network;
import android.content.Context; import android.content.Context;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory; import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen; import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.widget.PreferenceCategoryController; import com.android.settings.widget.PreferenceCategoryController;
import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver; import com.android.settingslib.core.lifecycle.LifecycleObserver;
@@ -15,6 +17,7 @@ public class NetworkProviderDownloadedSimsCategoryController extends
private static final String KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM = private static final String KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM =
"provider_model_downloaded_sim_category"; "provider_model_downloaded_sim_category";
private PreferenceCategory mPreferenceCategory;
private NetworkProviderDownloadedSimListController mNetworkProviderDownloadedSimListController; private NetworkProviderDownloadedSimListController mNetworkProviderDownloadedSimListController;
public NetworkProviderDownloadedSimsCategoryController(Context context, String key) { public NetworkProviderDownloadedSimsCategoryController(Context context, String key) {
@@ -44,9 +47,19 @@ public class NetworkProviderDownloadedSimsCategoryController extends
@Override @Override
public void displayPreference(PreferenceScreen screen) { public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen); super.displayPreference(screen);
PreferenceCategory preferenceCategory = screen.findPreference( mPreferenceCategory = screen.findPreference(
KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM); KEY_PREFERENCE_CATEGORY_DOWNLOADED_SIM);
preferenceCategory.setVisible(isAvailable()); mPreferenceCategory.setVisible(isAvailable());
mNetworkProviderDownloadedSimListController.displayPreference(screen); 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);
}
} }

View File

@@ -710,6 +710,11 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
Log.i(TAG, "onWifiStateChanged called with wifi state: " + wifiState); 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) { switch (wifiState) {
case WifiManager.WIFI_STATE_ENABLED: case WifiManager.WIFI_STATE_ENABLED:
updateWifiEntryPreferences(); updateWifiEntryPreferences();
@@ -981,6 +986,11 @@ public class NetworkProviderSettings extends RestrictedSettingsFragment
private String getSavedNetworkSettingsSummaryText( private String getSavedNetworkSettingsSummaryText(
int numSavedNetworks, int numSavedSubscriptions) { int numSavedNetworks, int numSavedSubscriptions) {
if (getResources() == null) {
Log.w(TAG, "getSavedNetworkSettingsSummaryText shouldn't run if resource is not ready");
return null;
}
if (numSavedSubscriptions == 0) { if (numSavedSubscriptions == 0) {
return getResources().getQuantityString(R.plurals.wifi_saved_access_points_summary, return getResources().getQuantityString(R.plurals.wifi_saved_access_points_summary,
numSavedNetworks, numSavedNetworks); numSavedNetworks, numSavedNetworks);

View File

@@ -46,7 +46,7 @@ public class CallsDefaultSubscriptionController extends DefaultSubscriptionContr
@Override @Override
public CharSequence getSummary() { public CharSequence getSummary() {
if (Utils.isProviderModelEnabled(mContext)) { if (Utils.isProviderModelEnabled(mContext)) {
return MobileNetworkUtils.getPreferredStatus(mContext, mManager, true); return MobileNetworkUtils.getPreferredStatus(isRtlMode(), mContext, mManager, true);
} else { } else {
return super.getSummary(); return super.getSummary();
} }

View File

@@ -26,6 +26,7 @@ import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager; import android.telecom.TelecomManager;
import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
import android.view.View;
import androidx.lifecycle.Lifecycle; import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver; import androidx.lifecycle.LifecycleObserver;
@@ -62,11 +63,14 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
private static final ComponentName PSTN_CONNECTION_SERVICE_COMPONENT = private static final ComponentName PSTN_CONNECTION_SERVICE_COMPONENT =
new ComponentName("com.android.phone", new ComponentName("com.android.phone",
"com.android.services.telephony.TelephonyConnectionService"); "com.android.services.telephony.TelephonyConnectionService");
private boolean mIsRtlMode;
public DefaultSubscriptionController(Context context, String preferenceKey) { public DefaultSubscriptionController(Context context, String preferenceKey) {
super(context, preferenceKey); super(context, preferenceKey);
mManager = context.getSystemService(SubscriptionManager.class); mManager = context.getSystemService(SubscriptionManager.class);
mChangeListener = new SubscriptionsChangeListener(context, this); mChangeListener = new SubscriptionsChangeListener(context, this);
mIsRtlMode = context.getResources().getConfiguration().getLayoutDirection()
== View.LAYOUT_DIRECTION_RTL;
} }
public void init(Lifecycle lifecycle) { public void init(Lifecycle lifecycle) {
@@ -285,4 +289,8 @@ public abstract class DefaultSubscriptionController extends TelephonyBasePrefere
refreshSummary(mPreference); refreshSummary(mPreference);
} }
} }
boolean isRtlMode() {
return mIsRtlMode;
}
} }

View File

@@ -99,6 +99,7 @@ public class MobileNetworkUtils {
"esim.enable_esim_system_ui_by_default"; "esim.enable_esim_system_ui_by_default";
private static final String LEGACY_ACTION_CONFIGURE_PHONE_ACCOUNT = private static final String LEGACY_ACTION_CONFIGURE_PHONE_ACCOUNT =
"android.telecom.action.CONNECTION_SERVICE_CONFIGURE"; "android.telecom.action.CONNECTION_SERVICE_CONFIGURE";
private static final String RTL_MARK = "\u200F";
// The following constants are used to draw signal icon. // The following constants are used to draw signal icon.
public static final int NO_CELL_DATA_TYPE_ICON = 0; 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. * 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) { SubscriptionManager subscriptionManager, boolean isPreferredCallStatus) {
final List<SubscriptionInfo> subs = SubscriptionUtil.getActiveSubscriptions( final List<SubscriptionInfo> subs = SubscriptionUtil.getActiveSubscriptions(
subscriptionManager); subscriptionManager);
@@ -956,6 +957,10 @@ public class MobileNetworkUtils {
if (subInfo != subs.get(subs.size() - 1)) { if (subInfo != subs.get(subs.size() - 1)) {
summary.append(", "); summary.append(", ");
} }
if (isRtlMode) {
summary.insert(0, RTL_MARK).insert(summary.length(), RTL_MARK);
}
} }
return summary; return summary;
} else { } else {

View File

@@ -62,7 +62,7 @@ public class SmsDefaultSubscriptionController extends DefaultSubscriptionControl
@Override @Override
public CharSequence getSummary() { public CharSequence getSummary() {
if (Utils.isProviderModelEnabled(mContext)) { if (Utils.isProviderModelEnabled(mContext)) {
return MobileNetworkUtils.getPreferredStatus(mContext, mManager, false); return MobileNetworkUtils.getPreferredStatus(isRtlMode(), mContext, mManager, false);
} else { } else {
return super.getSummary(); return super.getSummary();
} }