Snap for 6421724 from 4b7a61adb7 to mainline-release

Change-Id: I0a2c9d283139d8dc89530fefb4e9d0435d799378
This commit is contained in:
android-build-team Robot
2020-04-23 07:05:42 +00:00
24 changed files with 171 additions and 1111 deletions

View File

@@ -28,6 +28,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:accessibilityLiveRegion="polite"
android:textAppearance="@android:style/TextAppearance.DeviceDefault.Widget.TextView" /> android:textAppearance="@android:style/TextAppearance.DeviceDefault.Widget.TextView" />
<LinearLayout <LinearLayout

View File

@@ -36,7 +36,7 @@
android:paddingTop="8dp" android:paddingTop="8dp"
android:gravity="start" android:gravity="start"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_toLeftOf="@+id/toggle" android:layout_toStartOf="@+id/toggle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
@@ -46,7 +46,7 @@
android:paddingHorizontal="8dp" android:paddingHorizontal="8dp"
android:paddingBottom="8dp" android:paddingBottom="8dp"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_toLeftOf="@+id/toggle" android:layout_toStartOf="@+id/toggle"
android:layout_below="@+id/title" android:layout_below="@+id/title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@@ -36,11 +36,11 @@
android:visibility="gone"> android:visibility="gone">
<LinearLayout <LinearLayout
android:layout_width="49dp" android:layout_width="36dp"
android:layout_height="49dp" android:layout_height="36dp"
android:gravity="center_vertical|center_horizontal" android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_marginStart="10dp"> android:layout_marginStart="16dp">
<ImageView <ImageView
android:id="@+id/title_icon" android:id="@+id/title_icon"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -50,7 +50,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="25dp" android:layout_marginStart="16dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="9dp" android:paddingBottom="9dp"

View File

@@ -25,6 +25,6 @@
style="@style/SliceViewSliderStyle" style="@style/SliceViewSliderStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingStart="8dp" android:paddingStart="0dp"
android:paddingEnd="8dp"/> android:paddingEnd="0dp"/>
</LinearLayout> </LinearLayout>

View File

@@ -511,10 +511,28 @@
<item name="android:background">?android:attr/colorBackgroundFloating</item> <item name="android:background">?android:attr/colorBackgroundFloating</item>
</style> </style>
<style name="SliceRowSliderStyle" parent="SliceRowStyle"> <style name="SliceRowSliderStyle">
<!-- 2dp start padding for the start icon -->
<item name="titleItemStartPadding">10dp</item>
<item name="titleItemEndPadding">0dp</item>
<!-- Padding between content and the start icon is 14dp -->
<item name="contentStartPadding">5dp</item>
<!-- Padding between content and end items is 16dp -->
<item name="contentEndPadding">16dp</item>
<!-- Both side margins of end item are 16dp -->
<item name="endItemStartPadding">0dp</item>
<item name="endItemEndPadding">24dp</item>
<!-- Both side margins of bottom divider are 12dp -->
<item name="bottomDividerStartPadding">12dp</item>
<item name="bottomDividerEndPadding">12dp</item>
<item name="actionDividerHeight">32dp</item>
<!-- Align text with slider --> <!-- Align text with slider -->
<item name="titleStartPadding">12dp</item> <item name="titleStartPadding">6dp</item>
<item name="subContentStartPadding">12dp</item> <item name="subContentStartPadding">6dp</item>
</style> </style>
<style name="ContextualCardSliceViewStyle" parent="SliceViewStyle"> <style name="ContextualCardSliceViewStyle" parent="SliceViewStyle">

View File

@@ -191,9 +191,7 @@ public class ToggleAccessibilityServicePreferenceFragment extends
case DialogEnums.DISABLE_WARNING_FROM_TOGGLE: case DialogEnums.DISABLE_WARNING_FROM_TOGGLE:
return SettingsEnums.DIALOG_ACCESSIBILITY_SERVICE_DISABLE; return SettingsEnums.DIALOG_ACCESSIBILITY_SERVICE_DISABLE;
case DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL: case DialogEnums.LAUNCH_ACCESSIBILITY_TUTORIAL:
return AccessibilityUtil.isGestureNavigateEnabled(getPrefContext()) return SettingsEnums.DIALOG_ACCESSIBILITY_TUTORIAL;
? SettingsEnums.DIALOG_TOGGLE_SCREEN_GESTURE_NAVIGATION
: SettingsEnums.DIALOG_TOGGLE_SCREEN_ACCESSIBILITY_BUTTON;
default: default:
return super.getDialogMetricsCategory(dialogId); return super.getDialogMetricsCategory(dialogId);
} }

View File

@@ -38,9 +38,9 @@ import androidx.recyclerview.widget.RecyclerView;
import com.android.internal.util.CollectionUtils; import com.android.internal.util.CollectionUtils;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.PreferenceControllerMixin; import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.network.ProxySubscriptionManager; import com.android.settings.network.ProxySubscriptionManager;
import com.android.settings.network.telephony.TelephonyBasePreferenceController;
import com.android.settings.widget.EntityHeaderController; import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.NetworkPolicyEditor; import com.android.settingslib.NetworkPolicyEditor;
import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.core.lifecycle.Lifecycle;
@@ -55,7 +55,7 @@ import java.util.List;
* subscriptions framework API if available. The controller reads subscription information from the * subscriptions framework API if available. The controller reads subscription information from the
* framework and falls back to legacy usage data if none are available. * framework and falls back to legacy usage data if none are available.
*/ */
public class DataUsageSummaryPreferenceController extends BasePreferenceController public class DataUsageSummaryPreferenceController extends TelephonyBasePreferenceController
implements PreferenceControllerMixin, LifecycleObserver, OnStart { implements PreferenceControllerMixin, LifecycleObserver, OnStart {
private static final String TAG = "DataUsageController"; private static final String TAG = "DataUsageController";
@@ -64,7 +64,6 @@ public class DataUsageSummaryPreferenceController extends BasePreferenceControll
private static final float RELATIVE_SIZE_LARGE = 1.25f * 1.25f; // (1/0.8)^2 private static final float RELATIVE_SIZE_LARGE = 1.25f * 1.25f; // (1/0.8)^2
private static final float RELATIVE_SIZE_SMALL = 1.0f / RELATIVE_SIZE_LARGE; // 0.8^2 private static final float RELATIVE_SIZE_SMALL = 1.0f / RELATIVE_SIZE_LARGE; // 0.8^2
private final Activity mActivity;
private final EntityHeaderController mEntityHeaderController; private final EntityHeaderController mEntityHeaderController;
private final Lifecycle mLifecycle; private final Lifecycle mLifecycle;
private final PreferenceFragmentCompat mFragment; private final PreferenceFragmentCompat mFragment;
@@ -97,8 +96,6 @@ public class DataUsageSummaryPreferenceController extends BasePreferenceControll
private long mCycleStart; private long mCycleStart;
/** The ending time of the billing cycle in ms since the epoch */ /** The ending time of the billing cycle in ms since the epoch */
private long mCycleEnd; private long mCycleEnd;
/** The subscription that we should show usage for. */
private int mSubscriptionId;
private Intent mManageSubscriptionIntent; private Intent mManageSubscriptionIntent;
@@ -106,7 +103,6 @@ public class DataUsageSummaryPreferenceController extends BasePreferenceControll
Lifecycle lifecycle, PreferenceFragmentCompat fragment, int subscriptionId) { Lifecycle lifecycle, PreferenceFragmentCompat fragment, int subscriptionId) {
super(activity, KEY); super(activity, KEY);
mActivity = activity;
mEntityHeaderController = EntityHeaderController.newInstance(activity, mEntityHeaderController = EntityHeaderController.newInstance(activity,
fragment, null); fragment, null);
mLifecycle = lifecycle; mLifecycle = lifecycle;
@@ -114,19 +110,23 @@ public class DataUsageSummaryPreferenceController extends BasePreferenceControll
init(subscriptionId); init(subscriptionId);
} }
protected void init(int subscriptionId) { /**
mSubscriptionId = subscriptionId; * Initialize based on subscription ID provided
* @param subscriptionId is the target subscriptionId
*/
public void init(int subscriptionId) {
mSubId = subscriptionId;
mDefaultTemplate = DataUsageUtils.getDefaultTemplate(mContext, mSubscriptionId); mDefaultTemplate = DataUsageUtils.getDefaultTemplate(mContext, mSubId);
final NetworkPolicyManager policyManager = final NetworkPolicyManager policyManager =
mContext.getSystemService(NetworkPolicyManager.class); mContext.getSystemService(NetworkPolicyManager.class);
mPolicyEditor = new NetworkPolicyEditor(policyManager); mPolicyEditor = new NetworkPolicyEditor(policyManager);
mHasMobileData = SubscriptionManager.isValidSubscriptionId(mSubscriptionId) mHasMobileData = SubscriptionManager.isValidSubscriptionId(mSubId)
&& DataUsageUtils.hasMobileData(mContext); && DataUsageUtils.hasMobileData(mContext);
mDataUsageController = new DataUsageController(mContext); mDataUsageController = new DataUsageController(mContext);
mDataUsageController.setSubscriptionId(mSubscriptionId); mDataUsageController.setSubscriptionId(mSubId);
mDataInfoController = new DataUsageInfoController(); mDataInfoController = new DataUsageInfoController();
if (mHasMobileData) { if (mHasMobileData) {
@@ -157,18 +157,17 @@ public class DataUsageSummaryPreferenceController extends BasePreferenceControll
mPolicyEditor = policyEditor; mPolicyEditor = policyEditor;
mDataUsageTemplate = dataUsageTemplate; mDataUsageTemplate = dataUsageTemplate;
mHasMobileData = true; mHasMobileData = true;
mActivity = activity;
mLifecycle = lifecycle; mLifecycle = lifecycle;
mEntityHeaderController = entityHeaderController; mEntityHeaderController = entityHeaderController;
mFragment = fragment; mFragment = fragment;
mSubscriptionId = subscriptionId; mSubId = subscriptionId;
} }
@Override @Override
public void onStart() { public void onStart() {
RecyclerView view = mFragment.getListView(); RecyclerView view = mFragment.getListView();
mEntityHeaderController.setRecyclerView(view, mLifecycle); mEntityHeaderController.setRecyclerView(view, mLifecycle);
mEntityHeaderController.styleActionBar(mActivity); mEntityHeaderController.styleActionBar((Activity) mContext);
} }
@VisibleForTesting @VisibleForTesting
@@ -189,7 +188,7 @@ public class DataUsageSummaryPreferenceController extends BasePreferenceControll
} }
@Override @Override
public int getAvailabilityStatus() { public int getAvailabilityStatus(int subId) {
return hasSim() return hasSim()
|| DataUsageUtils.hasWifiRadio(mContext) ? AVAILABLE : CONDITIONALLY_UNAVAILABLE; || DataUsageUtils.hasWifiRadio(mContext) ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
} }
@@ -199,7 +198,7 @@ public class DataUsageSummaryPreferenceController extends BasePreferenceControll
DataUsageSummaryPreference summaryPreference = (DataUsageSummaryPreference) preference; DataUsageSummaryPreference summaryPreference = (DataUsageSummaryPreference) preference;
final DataUsageController.DataUsageInfo info; final DataUsageController.DataUsageInfo info;
final SubscriptionInfo subInfo = getSubscriptionInfo(mSubscriptionId); final SubscriptionInfo subInfo = getSubscriptionInfo(mSubId);
if (hasSim()) { if (hasSim()) {
info = mDataUsageController.getDataUsageInfo(mDefaultTemplate); info = mDataUsageController.getDataUsageInfo(mDefaultTemplate);
mDataInfoController.updateDataLimit(info, mPolicyEditor.getPolicy(mDefaultTemplate)); mDataInfoController.updateDataLimit(info, mPolicyEditor.getPolicy(mDefaultTemplate));
@@ -272,7 +271,7 @@ public class DataUsageSummaryPreferenceController extends BasePreferenceControll
if (subInfo != null && mHasMobileData) { if (subInfo != null && mHasMobileData) {
mCarrierName = subInfo.getCarrierName(); mCarrierName = subInfo.getCarrierName();
final List<SubscriptionPlan> plans = getSubscriptionPlans(mSubscriptionId); final List<SubscriptionPlan> plans = getSubscriptionPlans(mSubId);
final SubscriptionPlan primaryPlan = getPrimaryPlan(plans); final SubscriptionPlan primaryPlan = getPrimaryPlan(plans);
if (primaryPlan != null) { if (primaryPlan != null) {
@@ -292,8 +291,8 @@ public class DataUsageSummaryPreferenceController extends BasePreferenceControll
mSnapshotTime = primaryPlan.getDataUsageTime(); mSnapshotTime = primaryPlan.getDataUsageTime();
} }
} }
mManageSubscriptionIntent = createManageSubscriptionIntent(mSubscriptionId); mManageSubscriptionIntent = createManageSubscriptionIntent(mSubId);
Log.i(TAG, "Have " + mDataplanCount + " plans, dflt sub-id " + mSubscriptionId Log.i(TAG, "Have " + mDataplanCount + " plans, dflt sub-id " + mSubId
+ ", intent " + mManageSubscriptionIntent); + ", intent " + mManageSubscriptionIntent);
} }
@@ -330,7 +329,7 @@ public class DataUsageSummaryPreferenceController extends BasePreferenceControll
intent.setPackage(owner); intent.setPackage(owner);
intent.putExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, subId); intent.putExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, subId);
if (mActivity.getPackageManager().queryIntentActivities(intent, if (mContext.getPackageManager().queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) { PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
return null; return null;
} }

View File

@@ -168,7 +168,7 @@ public class MediaOutputGroupSlice implements CustomSliceable {
} }
private IconCompat getDisabledCheckboxIcon() { private IconCompat getDisabledCheckboxIcon() {
final Drawable drawable = mContext.getDrawable(R.drawable.ic_check_box_blue_24dp); final Drawable drawable = mContext.getDrawable(R.drawable.ic_check_box_blue_24dp).mutate();
final Bitmap checkbox = Bitmap.createBitmap(drawable.getIntrinsicWidth(), final Bitmap checkbox = Bitmap.createBitmap(drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(checkbox); final Canvas canvas = new Canvas(checkbox);

View File

@@ -68,6 +68,7 @@ public class ApnEditor extends SettingsPreferenceFragment
private final static boolean VDBG = false; // STOPSHIP if true private final static boolean VDBG = false; // STOPSHIP if true
private final static String KEY_AUTH_TYPE = "auth_type"; private final static String KEY_AUTH_TYPE = "auth_type";
private static final String KEY_APN_TYPE = "apn_type";
private final static String KEY_PROTOCOL = "apn_protocol"; private final static String KEY_PROTOCOL = "apn_protocol";
private final static String KEY_ROAMING_PROTOCOL = "apn_roaming_protocol"; private final static String KEY_ROAMING_PROTOCOL = "apn_roaming_protocol";
private final static String KEY_CARRIER_ENABLED = "carrier_enabled"; private final static String KEY_CARRIER_ENABLED = "carrier_enabled";
@@ -344,6 +345,7 @@ public class ApnEditor extends SettingsPreferenceFragment
public void onViewStateRestored(@Nullable Bundle savedInstanceState) { public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
super.onViewStateRestored(savedInstanceState); super.onViewStateRestored(savedInstanceState);
fillUI(savedInstanceState == null); fillUI(savedInstanceState == null);
setCarrierCustomizedConfigToUi();
} }
@VisibleForTesting @VisibleForTesting
@@ -645,7 +647,9 @@ public class ApnEditor extends SettingsPreferenceFragment
* return null. * return null.
*/ */
private String protocolDescription(String raw, ListPreference protocol) { private String protocolDescription(String raw, ListPreference protocol) {
final int protocolIndex = protocol.findIndexOfValue(raw); String uRaw = checkNull(raw).toUpperCase();
uRaw = uRaw.equals("IPV4") ? "IP" : uRaw;
final int protocolIndex = protocol.findIndexOfValue(uRaw);
if (protocolIndex == -1) { if (protocolIndex == -1) {
return null; return null;
} else { } else {
@@ -745,6 +749,13 @@ public class ApnEditor extends SettingsPreferenceFragment
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
return false; return false;
} }
} else if (KEY_APN_TYPE.equals(key)) {
String data = (TextUtils.isEmpty((String) newValue)
&& !ArrayUtils.isEmpty(mDefaultApnTypes))
? getEditableApnType(mDefaultApnTypes) : (String) newValue;
if (!TextUtils.isEmpty(data)) {
mApnType.setSummary(data);
}
} else if (KEY_PROTOCOL.equals(key)) { } else if (KEY_PROTOCOL.equals(key)) {
final String protocol = protocolDescription((String) newValue, mProtocol); final String protocol = protocolDescription((String) newValue, mProtocol);
if (protocol == null) { if (protocol == null) {
@@ -780,7 +791,6 @@ public class ApnEditor extends SettingsPreferenceFragment
} else { } else {
preference.setSummary(checkNull(newValue != null ? String.valueOf(newValue) : null)); preference.setSummary(checkNull(newValue != null ? String.valueOf(newValue) : null));
} }
return true; return true;
} }
@@ -1002,13 +1012,13 @@ public class ApnEditor extends SettingsPreferenceFragment
callUpdate = setStringValueAndCheckIfDiff(values, callUpdate = setStringValueAndCheckIfDiff(values,
Telephony.Carriers.PROTOCOL, Telephony.Carriers.PROTOCOL,
getUserEnteredApnProtocol(mProtocol, mDefaultApnProtocol), checkNotSet(mProtocol.getValue()),
callUpdate, callUpdate,
PROTOCOL_INDEX); PROTOCOL_INDEX);
callUpdate = setStringValueAndCheckIfDiff(values, callUpdate = setStringValueAndCheckIfDiff(values,
Telephony.Carriers.ROAMING_PROTOCOL, Telephony.Carriers.ROAMING_PROTOCOL,
getUserEnteredApnProtocol(mRoamingProtocol, mDefaultApnRoamingProtocol), checkNotSet(mRoamingProtocol.getValue()),
callUpdate, callUpdate,
ROAMING_PROTOCOL_INDEX); ROAMING_PROTOCOL_INDEX);
@@ -1204,17 +1214,6 @@ public class ApnEditor extends SettingsPreferenceFragment
return sNotSet.equals(value) ? null : value; return sNotSet.equals(value) ? null : value;
} }
@VisibleForTesting
String getUserEnteredApnProtocol(ListPreference preference, String defaultApnProtocol) {
// if user has not specified a protocol or enter empty type, map it just for default
final String userEnteredApnProtocol = checkNotSet(
((preference == null) ? null : preference.getValue()));
if (TextUtils.isEmpty(userEnteredApnProtocol)) {
return defaultApnProtocol;
}
return userEnteredApnProtocol.trim();
}
@VisibleForTesting @VisibleForTesting
String getUserEnteredApnType() { String getUserEnteredApnType() {
// if user has not specified a type, map it to "ALL APN TYPES THAT ARE NOT READ-ONLY" // if user has not specified a type, map it to "ALL APN TYPES THAT ARE NOT READ-ONLY"
@@ -1222,16 +1221,11 @@ public class ApnEditor extends SettingsPreferenceFragment
String userEnteredApnType = mApnType.getText(); String userEnteredApnType = mApnType.getText();
if (userEnteredApnType != null) userEnteredApnType = userEnteredApnType.trim(); if (userEnteredApnType != null) userEnteredApnType = userEnteredApnType.trim();
if ((TextUtils.isEmpty(userEnteredApnType) if ((TextUtils.isEmpty(userEnteredApnType)
|| APN_TYPE_ALL.equals(userEnteredApnType)) || APN_TYPE_ALL.equals(userEnteredApnType))) {
&& !ArrayUtils.isEmpty(mReadOnlyApnTypes)) { userEnteredApnType = getEditableApnType(APN_TYPES);
String[] apnTypeList = APN_TYPES;
if (TextUtils.isEmpty(userEnteredApnType) && !ArrayUtils.isEmpty(mDefaultApnTypes)) {
apnTypeList = mDefaultApnTypes;
} }
userEnteredApnType = getEditableApnType(apnTypeList);
Log.d(TAG, "getUserEnteredApnType: changed apn type to editable apn types: " Log.d(TAG, "getUserEnteredApnType: changed apn type to editable apn types: "
+ userEnteredApnType); + userEnteredApnType);
}
return userEnteredApnType; return userEnteredApnType;
} }
@@ -1324,6 +1318,26 @@ public class ApnEditor extends SettingsPreferenceFragment
} }
} }
private void setCarrierCustomizedConfigToUi() {
if (TextUtils.isEmpty(mApnType.getText()) && !ArrayUtils.isEmpty(mDefaultApnTypes)) {
String value = getEditableApnType(mDefaultApnTypes);
mApnType.setText(value);
mApnType.setSummary(value);
}
String protocol = protocolDescription(mDefaultApnProtocol, mProtocol);
if (TextUtils.isEmpty(mProtocol.getValue()) && !TextUtils.isEmpty(protocol)) {
mProtocol.setValue(mDefaultApnProtocol);
mProtocol.setSummary(protocol);
}
String roamingProtocol = protocolDescription(mDefaultApnRoamingProtocol, mRoamingProtocol);
if (TextUtils.isEmpty(mRoamingProtocol.getValue()) && !TextUtils.isEmpty(roamingProtocol)) {
mRoamingProtocol.setValue(mDefaultApnRoamingProtocol);
mRoamingProtocol.setSummary(roamingProtocol);
}
}
public static class ErrorDialog extends InstrumentedDialogFragment { public static class ErrorDialog extends InstrumentedDialogFragment {
public static void showError(ApnEditor editor) { public static void showError(ApnEditor editor) {

View File

@@ -35,8 +35,6 @@ import com.android.settingslib.net.DataUsageController;
public class DataUsagePreferenceController extends TelephonyBasePreferenceController { public class DataUsagePreferenceController extends TelephonyBasePreferenceController {
private NetworkTemplate mTemplate; private NetworkTemplate mTemplate;
private DataUsageController.DataUsageInfo mDataUsageInfo;
private Intent mIntent;
public DataUsagePreferenceController(Context context, String key) { public DataUsagePreferenceController(Context context, String key) {
super(context, key); super(context, key);
@@ -54,8 +52,11 @@ public class DataUsagePreferenceController extends TelephonyBasePreferenceContro
if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) { if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) {
return false; return false;
} }
final Intent intent = new Intent(Settings.ACTION_MOBILE_DATA_USAGE);
intent.putExtra(Settings.EXTRA_NETWORK_TEMPLATE, mTemplate);
intent.putExtra(Settings.EXTRA_SUB_ID, mSubId);
mContext.startActivity(mIntent); mContext.startActivity(intent);
return true; return true;
} }
@@ -66,34 +67,38 @@ public class DataUsagePreferenceController extends TelephonyBasePreferenceContro
preference.setEnabled(false); preference.setEnabled(false);
return; return;
} }
long usageLevel = mDataUsageInfo.usageLevel; final CharSequence summary = getDataUsageSummary(mContext, mSubId);
if (usageLevel <= 0L) { if (summary == null) {
final DataUsageController controller = new DataUsageController(mContext); preference.setEnabled(false);
usageLevel = controller.getHistoricalUsageLevel(mTemplate); } else {
} preference.setEnabled(true);
final boolean enabled = usageLevel > 0L; preference.setSummary(summary);
preference.setEnabled(enabled);
if (enabled) {
preference.setSummary(mContext.getString(R.string.data_usage_template,
DataUsageUtils.formatDataUsage(mContext, mDataUsageInfo.usageLevel),
mDataUsageInfo.period));
} }
} }
public void init(int subId) { public void init(int subId) {
mSubId = subId; mSubId = subId;
if (mSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { if (!SubscriptionManager.isValidSubscriptionId(subId)) {
mTemplate = DataUsageUtils.getDefaultTemplate(mContext, mSubId); return;
final DataUsageController controller = new DataUsageController(mContext);
controller.setSubscriptionId(mSubId);
mDataUsageInfo = controller.getDataUsageInfo(mTemplate);
mIntent = new Intent(Settings.ACTION_MOBILE_DATA_USAGE);
mIntent.putExtra(Settings.EXTRA_NETWORK_TEMPLATE, mTemplate);
mIntent.putExtra(Settings.EXTRA_SUB_ID, mSubId);
} }
mTemplate = DataUsageUtils.getDefaultTemplate(mContext, mSubId);
}
private CharSequence getDataUsageSummary(Context context, int subId) {
final DataUsageController controller = new DataUsageController(context);
controller.setSubscriptionId(subId);
final DataUsageController.DataUsageInfo usageInfo = controller.getDataUsageInfo(mTemplate);
long usageLevel = usageInfo.usageLevel;
if (usageLevel <= 0L) {
usageLevel = controller.getHistoricalUsageLevel(mTemplate);
}
if (usageLevel <= 0L) {
return null;
}
return context.getString(R.string.data_usage_template,
DataUsageUtils.formatDataUsage(context, usageLevel), usageInfo.period);
} }
} }

View File

@@ -133,6 +133,9 @@ public class Enhanced4gBasePreferenceController extends TelephonyTogglePreferenc
@Override @Override
public void updateState(Preference preference) { public void updateState(Preference preference) {
super.updateState(preference); super.updateState(preference);
if (preference == null) {
return;
}
final SwitchPreference switchPreference = (SwitchPreference) preference; final SwitchPreference switchPreference = (SwitchPreference) preference;
final VolteQueryImsState queryState = queryImsState(mSubId); final VolteQueryImsState queryState = queryImsState(mSubId);

View File

@@ -91,7 +91,8 @@ public class VideoCallingPreferenceController extends TelephonyTogglePreferenceC
@Override @Override
public void updateState(Preference preference) { public void updateState(Preference preference) {
super.updateState(preference); super.updateState(preference);
if (mCallState == null) { if ((mCallState == null) || (preference == null)) {
Log.d(TAG, "Skip update under mCallState=" + mCallState);
return; return;
} }
final SwitchPreference switchPreference = (SwitchPreference) preference; final SwitchPreference switchPreference = (SwitchPreference) preference;

View File

@@ -30,6 +30,7 @@ import android.telephony.PhoneStateListener;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.telephony.ims.ImsMmTelManager; import android.telephony.ims.ImsMmTelManager;
import android.util.Log;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference; import androidx.preference.Preference;
@@ -98,7 +99,8 @@ public class WifiCallingPreferenceController extends TelephonyBasePreferenceCont
@Override @Override
public void updateState(Preference preference) { public void updateState(Preference preference) {
super.updateState(preference); super.updateState(preference);
if (mCallState == null) { if ((mCallState == null) || (preference == null)) {
Log.d(TAG, "Skip update under mCallState=" + mCallState);
return; return;
} }
CharSequence summaryText = null; CharSequence summaryText = null;

View File

@@ -201,6 +201,8 @@ public class PanelFragment extends Fragment {
final IconCompat icon = mPanel.getIcon(); final IconCompat icon = mPanel.getIcon();
if (icon == null) { if (icon == null) {
mTitleView.setVisibility(View.VISIBLE);
mPanelHeader.setVisibility(View.GONE);
mTitleView.setText(mPanel.getTitle()); mTitleView.setText(mPanel.getTitle());
} else { } else {
mTitleView.setVisibility(View.GONE); mTitleView.setVisibility(View.GONE);
@@ -220,6 +222,7 @@ public class PanelFragment extends Fragment {
if (TextUtils.isEmpty(customTitle)) { if (TextUtils.isEmpty(customTitle)) {
mSeeMoreButton.setVisibility(View.GONE); mSeeMoreButton.setVisibility(View.GONE);
} else { } else {
mSeeMoreButton.setVisibility(View.VISIBLE);
mSeeMoreButton.setText(customTitle); mSeeMoreButton.setText(customTitle);
} }
} else if (mPanel.getSeeMoreIntent() == null) { } else if (mPanel.getSeeMoreIntent() == null) {

View File

@@ -117,7 +117,7 @@ public class SettingsPanelActivity extends FragmentActivity {
if (!shouldForceCreation && fragment != null && fragment instanceof PanelFragment) { if (!shouldForceCreation && fragment != null && fragment instanceof PanelFragment) {
final PanelFragment panelFragment = (PanelFragment) fragment; final PanelFragment panelFragment = (PanelFragment) fragment;
panelFragment.setArguments(mBundle); panelFragment.setArguments(mBundle);
((PanelFragment) fragment).updatePanelWithAnimation(); panelFragment.updatePanelWithAnimation();
} else { } else {
setContentView(R.layout.settings_panel); setContentView(R.layout.settings_panel);

View File

@@ -24,6 +24,8 @@ import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment;
import com.android.settings.connecteddevice.usb.UsbDetailsFragment; import com.android.settings.connecteddevice.usb.UsbDetailsFragment;
import com.android.settings.fuelgauge.PowerUsageAdvanced; import com.android.settings.fuelgauge.PowerUsageAdvanced;
import com.android.settings.fuelgauge.PowerUsageSummary; import com.android.settings.fuelgauge.PowerUsageSummary;
import com.android.settings.gestures.GestureNavigationSettingsFragment;
import com.android.settings.gestures.SystemNavigationGestureSettings;
import com.android.settings.location.LocationSettings; import com.android.settings.location.LocationSettings;
import com.android.settings.location.RecentLocationRequestSeeAllFragment; import com.android.settings.location.RecentLocationRequestSeeAllFragment;
import com.android.settings.network.NetworkDashboardFragment; import com.android.settings.network.NetworkDashboardFragment;
@@ -63,5 +65,7 @@ public class CustomSiteMapRegistry {
SystemDashboardFragment.class.getName()); SystemDashboardFragment.class.getName());
CUSTOM_SITE_MAP.put(ZenModeBlockedEffectsSettings.class.getName(), CUSTOM_SITE_MAP.put(ZenModeBlockedEffectsSettings.class.getName(),
ZenModeRestrictNotificationsSettings.class.getName()); ZenModeRestrictNotificationsSettings.class.getName());
CUSTOM_SITE_MAP.put(GestureNavigationSettingsFragment.class.getName(),
SystemNavigationGestureSettings.class.getName());
} }
} }

View File

@@ -55,7 +55,6 @@ import com.android.settingslib.net.DataUsageController;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Answers; import org.mockito.Answers;
@@ -170,7 +169,6 @@ public class DataUsageSummaryPreferenceControllerTest {
} }
@Test @Test
@Ignore
public void testSummaryUpdate_onePlan_basic() { public void testSummaryUpdate_onePlan_basic() {
final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis();
final DataUsageController.DataUsageInfo info = createTestDataUsageInfo(now); final DataUsageController.DataUsageInfo info = createTestDataUsageInfo(now);
@@ -198,7 +196,6 @@ public class DataUsageSummaryPreferenceControllerTest {
} }
@Test @Test
@Ignore
public void testSummaryUpdate_noPlan_basic() { public void testSummaryUpdate_noPlan_basic() {
final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis();
final DataUsageController.DataUsageInfo info = createTestDataUsageInfo(now); final DataUsageController.DataUsageInfo info = createTestDataUsageInfo(now);
@@ -227,7 +224,6 @@ public class DataUsageSummaryPreferenceControllerTest {
} }
@Test @Test
@Ignore
public void testSummaryUpdate_noCarrier_basic() { public void testSummaryUpdate_noCarrier_basic() {
final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis();
final DataUsageController.DataUsageInfo info = createTestDataUsageInfo(now); final DataUsageController.DataUsageInfo info = createTestDataUsageInfo(now);
@@ -255,7 +251,6 @@ public class DataUsageSummaryPreferenceControllerTest {
} }
@Test @Test
@Ignore
public void testSummaryUpdate_noPlanData_basic() { public void testSummaryUpdate_noPlanData_basic() {
final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis();
@@ -283,7 +278,6 @@ public class DataUsageSummaryPreferenceControllerTest {
} }
@Test @Test
@Ignore
public void testSummaryUpdate_noLimitNoWarning() { public void testSummaryUpdate_noLimitNoWarning() {
final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis();
final DataUsageController.DataUsageInfo info = createTestDataUsageInfo(now); final DataUsageController.DataUsageInfo info = createTestDataUsageInfo(now);
@@ -300,7 +294,6 @@ public class DataUsageSummaryPreferenceControllerTest {
} }
@Test @Test
@Ignore
public void testSummaryUpdate_warningOnly() { public void testSummaryUpdate_warningOnly() {
final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis();
final DataUsageController.DataUsageInfo info = createTestDataUsageInfo(now); final DataUsageController.DataUsageInfo info = createTestDataUsageInfo(now);
@@ -321,7 +314,6 @@ public class DataUsageSummaryPreferenceControllerTest {
} }
@Test @Test
@Ignore
public void testSummaryUpdate_limitOnly() { public void testSummaryUpdate_limitOnly() {
final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis();
final DataUsageController.DataUsageInfo info = createTestDataUsageInfo(now); final DataUsageController.DataUsageInfo info = createTestDataUsageInfo(now);
@@ -342,7 +334,6 @@ public class DataUsageSummaryPreferenceControllerTest {
} }
@Test @Test
@Ignore
public void testSummaryUpdate_limitAndWarning() { public void testSummaryUpdate_limitAndWarning() {
final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis();
final DataUsageController.DataUsageInfo info = createTestDataUsageInfo(now); final DataUsageController.DataUsageInfo info = createTestDataUsageInfo(now);
@@ -365,7 +356,6 @@ public class DataUsageSummaryPreferenceControllerTest {
} }
@Test @Test
@Ignore
public void testSummaryUpdate_noSim_shouldSetWifiMode() { public void testSummaryUpdate_noSim_shouldSetWifiMode() {
mController.init(SubscriptionManager.INVALID_SUBSCRIPTION_ID); mController.init(SubscriptionManager.INVALID_SUBSCRIPTION_ID);
mController.mDataUsageController = mDataUsageController; mController.mDataUsageController = mDataUsageController;
@@ -393,13 +383,11 @@ public class DataUsageSummaryPreferenceControllerTest {
} }
@Test @Test
@Ignore
public void testMobileData_preferenceAvailable() { public void testMobileData_preferenceAvailable() {
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE); assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
} }
@Test @Test
@Ignore
public void testMobileData_noSimNoWifi_preferenceDisabled() { public void testMobileData_noSimNoWifi_preferenceDisabled() {
final int subscriptionId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; final int subscriptionId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
mController.init(subscriptionId); mController.init(subscriptionId);
@@ -412,7 +400,6 @@ public class DataUsageSummaryPreferenceControllerTest {
} }
@Test @Test
@Ignore
public void testMobileData_noSimWifi_preferenceDisabled() { public void testMobileData_noSimWifi_preferenceDisabled() {
final int subscriptionId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; final int subscriptionId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
mController.init(subscriptionId); mController.init(subscriptionId);

View File

@@ -18,6 +18,7 @@ package com.android.settings.development;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import android.content.Context; import android.content.Context;
@@ -27,7 +28,6 @@ import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreference; import androidx.preference.SwitchPreference;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
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.Mock;
@@ -75,13 +75,12 @@ public class WifiEnhancedMacRandomizationPreferenceControllerTest {
} }
@Test @Test
@Ignore
public void updateState_preferenceShouldBeChecked() { public void updateState_preferenceShouldBeChecked() {
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.putInt(mContext.getContentResolver(),
ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, 1); ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, 1);
mController.updateState(mPreference); mController.updateState(mPreference);
assertThat(mPreference.isChecked()).isTrue(); verify(mPreference).setChecked(true);
} }
@Test @Test
@@ -90,7 +89,7 @@ public class WifiEnhancedMacRandomizationPreferenceControllerTest {
ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, 0); ENHANCED_MAC_RANDOMIZATION_FEATURE_FLAG, 0);
mController.updateState(mPreference); mController.updateState(mPreference);
assertThat(mPreference.isChecked()).isFalse(); verify(mPreference).setChecked(false);
} }
@Test @Test

View File

@@ -81,11 +81,11 @@ public class ApnEditorTest {
"" /* MMS port */, "" /* MMS port */,
0 /* Authentication type */, 0 /* Authentication type */,
"default,supl,ia" /* APN type */, "default,supl,ia" /* APN type */,
"IPv6" /* APN protocol */, "IP" /* APN protocol */,
1 /* APN enable/disable */, 1 /* APN enable/disable */,
0 /* Bearer */, 0 /* Bearer */,
0 /* Bearer BITMASK*/, 0 /* Bearer BITMASK*/,
"IPv4" /* APN roaming protocol */, "IPV6" /* APN roaming protocol */,
"None" /* MVNO type */, "None" /* MVNO type */,
"", /* MVNO value */ "", /* MVNO value */
}; };
@@ -464,33 +464,25 @@ public class ApnEditorTest {
} }
@Test @Test
public void getUserEnteredApnProtocol_emptyApnProtocol_shouldReturnDefaultIPv4v6() { public void testOnViewStateRestored_customizedValueWithoutDefault_shouldShowCustomized() {
// GIVEN read default APN protocol with IPV4V6 mApnEditorUT.mDefaultApnProtocol = "IP";
mApnEditorUT.mDefaultApnProtocol = "IPV4V6"; mApnEditorUT.mApnData.mData[ApnEditor.PROTOCOL_INDEX] = null;
mApnEditorUT.mProtocol.setEntryValues(new CharSequence[]{"IP", "IPV6", "IPV4V6"});
// Input empty in TYPE mApnEditorUT.onViewStateRestored(null);
mApnEditorUT.mApnData.mData[ApnEditor.PROTOCOL_INDEX] = "";
mApnEditorUT.fillUI(true /* firstTime */);
// THEN APN type should be IPV4V6 assertThat(mApnEditorUT.mProtocol.getSummary()).isEqualTo("IPv4");
assertThat(mApnEditorUT.getUserEnteredApnProtocol(
mApnEditorUT.mProtocol, mApnEditorUT.mDefaultApnProtocol))
.isEqualTo("IPV4V6");
} }
@Test @Test
public void getUserEnteredApnProtocol_emptyApnProtocol_shouldReturnDefaultIP() { public void testOnViewStateRestored_customizedValueWithDefault_shouldShowDefault() {
// GIVEN read default APN protocol with IP
mApnEditorUT.mDefaultApnProtocol = "IP"; mApnEditorUT.mDefaultApnProtocol = "IP";
mApnEditorUT.mApnData.mData[ApnEditor.PROTOCOL_INDEX] = "IPV6";
mApnEditorUT.mProtocol.setEntryValues(new CharSequence[]{"IP", "IPV6", "IPV4V6"});
// Input empty in TYPE mApnEditorUT.onViewStateRestored(null);
mApnEditorUT.mApnData.mData[ApnEditor.PROTOCOL_INDEX] = "";
mApnEditorUT.fillUI(true /* firstTime */);
// THEN APN type should be IPV4V6 assertThat(mApnEditorUT.mProtocol.getSummary()).isEqualTo("IPv6");
assertThat(mApnEditorUT.getUserEnteredApnProtocol(
mApnEditorUT.mProtocol, mApnEditorUT.mDefaultApnProtocol))
.isEqualTo("IP");
} }
@Test @Test
@@ -503,7 +495,7 @@ public class ApnEditorTest {
// Input empty in TYPE // Input empty in TYPE
mApnEditorUT.mApnData.mData[ApnEditor.TYPE_INDEX] = ""; mApnEditorUT.mApnData.mData[ApnEditor.TYPE_INDEX] = "";
mApnEditorUT.fillUI(true /* firstTime */); mApnEditorUT.onViewStateRestored(null);
// THEN APN type should be default // THEN APN type should be default
assertThat(mApnEditorUT.getUserEnteredApnType()).isEqualTo("default"); assertThat(mApnEditorUT.getUserEnteredApnType()).isEqualTo("default");
@@ -516,7 +508,7 @@ public class ApnEditorTest {
// Input empty in TYPE // Input empty in TYPE
mApnEditorUT.mApnData.mData[ApnEditor.TYPE_INDEX] = ""; mApnEditorUT.mApnData.mData[ApnEditor.TYPE_INDEX] = "";
mApnEditorUT.fillUI(true /* firstTime */); mApnEditorUT.onViewStateRestored(null);
// THEN APN type should be default // THEN APN type should be default
assertThat(mApnEditorUT.getUserEnteredApnType()).isEqualTo("default"); assertThat(mApnEditorUT.getUserEnteredApnType()).isEqualTo("default");

View File

@@ -24,6 +24,7 @@ import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import android.content.Context; import android.content.Context;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import org.junit.Before; import org.junit.Before;
@@ -43,6 +44,8 @@ public class NrDisabledInDsdsFooterPreferenceControllerTest {
private Context mContext; private Context mContext;
@Mock @Mock
private TelephonyManager mTelephonyManager; private TelephonyManager mTelephonyManager;
@Mock
private SubscriptionManager mSubscriptionManager;
private NrDisabledInDsdsFooterPreferenceController mController; private NrDisabledInDsdsFooterPreferenceController mController;
@Before @Before
@@ -50,6 +53,8 @@ public class NrDisabledInDsdsFooterPreferenceControllerTest {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application); mContext = spy(RuntimeEnvironment.application);
doReturn(mTelephonyManager).when(mContext).getSystemService(Context.TELEPHONY_SERVICE); doReturn(mTelephonyManager).when(mContext).getSystemService(Context.TELEPHONY_SERVICE);
doReturn(mSubscriptionManager).when(mContext).getSystemService(
Context.TELEPHONY_SUBSCRIPTION_SERVICE);
doReturn(mTelephonyManager).when(mTelephonyManager).createForSubscriptionId(anyInt()); doReturn(mTelephonyManager).when(mTelephonyManager).createForSubscriptionId(anyInt());
mController = new NrDisabledInDsdsFooterPreferenceController(mContext, PREF_KEY); mController = new NrDisabledInDsdsFooterPreferenceController(mContext, PREF_KEY);
} }
@@ -64,7 +69,7 @@ public class NrDisabledInDsdsFooterPreferenceControllerTest {
public void isAvailable_dataOnAndDsdsAnd5GSupported_Available() { public void isAvailable_dataOnAndDsdsAnd5GSupported_Available() {
when(mTelephonyManager.getSupportedRadioAccessFamily()) when(mTelephonyManager.getSupportedRadioAccessFamily())
.thenReturn(TelephonyManager.NETWORK_TYPE_BITMASK_NR); .thenReturn(TelephonyManager.NETWORK_TYPE_BITMASK_NR);
when(mTelephonyManager.getActiveModemCount()).thenReturn(2); when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[] {1, 2});
when(mTelephonyManager.isDataEnabled()).thenReturn(true); when(mTelephonyManager.isDataEnabled()).thenReturn(true);
mController.init(SUB_ID); mController.init(SUB_ID);
assertThat(mController.isAvailable()).isTrue(); assertThat(mController.isAvailable()).isTrue();
@@ -74,7 +79,7 @@ public class NrDisabledInDsdsFooterPreferenceControllerTest {
public void isAvailable_5gNotSupported_notAvailable() { public void isAvailable_5gNotSupported_notAvailable() {
when(mTelephonyManager.getSupportedRadioAccessFamily()) when(mTelephonyManager.getSupportedRadioAccessFamily())
.thenReturn(TelephonyManager.NETWORK_TYPE_BITMASK_LTE); .thenReturn(TelephonyManager.NETWORK_TYPE_BITMASK_LTE);
when(mTelephonyManager.getActiveModemCount()).thenReturn(2); when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[] {1, 2});
when(mTelephonyManager.isDataEnabled()).thenReturn(true); when(mTelephonyManager.isDataEnabled()).thenReturn(true);
mController.init(SUB_ID); mController.init(SUB_ID);
assertThat(mController.isAvailable()).isFalse(); assertThat(mController.isAvailable()).isFalse();
@@ -84,7 +89,7 @@ public class NrDisabledInDsdsFooterPreferenceControllerTest {
public void isAvailable_mobileDataOff_notAvailable() { public void isAvailable_mobileDataOff_notAvailable() {
when(mTelephonyManager.getSupportedRadioAccessFamily()) when(mTelephonyManager.getSupportedRadioAccessFamily())
.thenReturn(TelephonyManager.NETWORK_TYPE_BITMASK_NR); .thenReturn(TelephonyManager.NETWORK_TYPE_BITMASK_NR);
when(mTelephonyManager.getActiveModemCount()).thenReturn(2); when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[] {1, 2});
when(mTelephonyManager.isDataEnabled()).thenReturn(false); when(mTelephonyManager.isDataEnabled()).thenReturn(false);
mController.init(SUB_ID); mController.init(SUB_ID);
assertThat(mController.isAvailable()).isFalse(); assertThat(mController.isAvailable()).isFalse();
@@ -94,7 +99,7 @@ public class NrDisabledInDsdsFooterPreferenceControllerTest {
public void isAvailable_singleSimMode_notAvailable() { public void isAvailable_singleSimMode_notAvailable() {
when(mTelephonyManager.getSupportedRadioAccessFamily()) when(mTelephonyManager.getSupportedRadioAccessFamily())
.thenReturn(TelephonyManager.NETWORK_TYPE_BITMASK_NR); .thenReturn(TelephonyManager.NETWORK_TYPE_BITMASK_NR);
when(mTelephonyManager.getActiveModemCount()).thenReturn(1); when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[] {1});
when(mTelephonyManager.isDataEnabled()).thenReturn(true); when(mTelephonyManager.isDataEnabled()).thenReturn(true);
mController.init(SUB_ID); mController.init(SUB_ID);
assertThat(mController.isAvailable()).isFalse(); assertThat(mController.isAvailable()).isFalse();

View File

@@ -24,6 +24,8 @@ import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment;
import com.android.settings.connecteddevice.usb.UsbDetailsFragment; import com.android.settings.connecteddevice.usb.UsbDetailsFragment;
import com.android.settings.fuelgauge.PowerUsageAdvanced; import com.android.settings.fuelgauge.PowerUsageAdvanced;
import com.android.settings.fuelgauge.PowerUsageSummary; import com.android.settings.fuelgauge.PowerUsageSummary;
import com.android.settings.gestures.GestureNavigationSettingsFragment;
import com.android.settings.gestures.SystemNavigationGestureSettings;
import com.android.settings.location.LocationSettings; import com.android.settings.location.LocationSettings;
import com.android.settings.location.RecentLocationRequestSeeAllFragment; import com.android.settings.location.RecentLocationRequestSeeAllFragment;
import com.android.settings.network.NetworkDashboardFragment; import com.android.settings.network.NetworkDashboardFragment;
@@ -94,4 +96,11 @@ public class CustomSiteMapRegistryTest {
ZenModeBlockedEffectsSettings.class.getName())).isEqualTo( ZenModeBlockedEffectsSettings.class.getName())).isEqualTo(
ZenModeRestrictNotificationsSettings.class.getName()); ZenModeRestrictNotificationsSettings.class.getName());
} }
@Test
public void shouldContainGestureNavigationSettingsFragmentPairs() {
assertThat(CustomSiteMapRegistry.CUSTOM_SITE_MAP.get(
GestureNavigationSettingsFragment.class.getName())).isEqualTo(
SystemNavigationGestureSettings.class.getName());
}
} }

View File

@@ -1,648 +0,0 @@
1 minute;accessibility_control_timeout_1min
10 seconds;accessibility_control_timeout_10secs
2 minutes;accessibility_control_timeout_2mins
30 seconds;accessibility_control_timeout_30secs
4G Calling;4g_calling
AP Band;wifi_tether_network_ap_band
About phone;my_device_info_pref_screen
About phone;top_level_about_device
Access Point Names;telephony_apn_key
Accessibility;accessibility_settings_screen
Accessibility;top_level_accessibility
Accessibility usage;privacy_accessibility_usage
Accounts;top_level_accounts
Accounts;user_and_account_settings_screen
Active Edge;gesture_assist_application
Active Edge;gesture_assist_input_summary
Active Edge;gesture_assist_settings_page
Adaptive Battery;smart_battery
Adaptive Battery;smart_battery_manager
Adaptive Notifications;notification_assistant
Adaptive brightness;auto_brightness
Adaptive brightness;auto_brightness_entry
Adaptive notification priority;asst_capability_prioritizer
Add more;add_more
Add more;zen_mode_add_automatic_rule
Add user or profile;user_add
Add users from lock screen;security_lockscreen_add_users_when_locked
Add users from lock screen;user_settings_add_users_when_locked
Additional system updates;additional_system_update_settings
Admin can delete all device data;enterprise_privacy_wipe_device
Admin can lock the device and reset password;enterprise_privacy_lock_device
Advanced Calling;advance_call
Airplane mode;airplane_mode
Alarm volume;alarm_volume
Allow alarms;zen_mode_alarms
Allow apps to override;zen_mode_bypassing_apps
Allow calls;zen_mode_calls
Allow calls;zen_mode_calls_settings
Allow events;zen_mode_events
Allow messages;zen_mode_messages
Allow messages;zen_mode_messages_settings
Allow notification dots;notification_badging
Allow notification snoozing;show_snooze_options
Allow reminders;zen_mode_reminders
Allow repeat callers;zen_mode_repeat_callers
Allow touch sounds;zen_mode_system
Allow when screen is off;gesture_assist_wake
Always on;ambient_display_always_on
Always require confirmation;security_settings_face_require_confirmation
Always show crash dialog;show_first_crash_dialog
Always-on VPN turned on in your work profile;always_on_vpn_managed_profile
Ambient EQ;display_white_balance
Amount of time and data spent in each app;enterprise_privacy_usage_stats
Android Beam;android_beam_settings
Android security patch level;security_key
Android version;firmware_version
Android version;os_firmware_version
Animator duration scale;animator_duration_scale
App data usage;data_usage_summary
App data usage cycle;billing_cycle
App exceptions;zen_mode_bypassing_apps_screen
App info;all_app_info
App permission;app_level_permissions
App sign-in & payments;security_settings_face_app
Apps & app data;storage_settings_apps_space
Apps & notifications;apps_and_notification_screen
Apps & notifications;top_level_apps_and_notifs
Apps installed;number_enterprise_installed_packages
Assist & voice input;manage_assist_screen
Assist app;default_assist
Audio (music, ringtones, podcasts, etc.);storage_settings_music_space
Audio balance;seekbar_master_balance
Auto-rotate screen;auto_rotate
Auto-rotate screen;toggle_lock_screen_rotation_preference
Auto-sync personal data;auto_sync_personal_account_data
Auto-sync work data;auto_sync_work_account_data
Autofill;debug_autofill_category
Autofill service;default_autofill
Autofill service;default_autofill_main
Autofill service;default_autofill_work
Automatic restore;auto_restore
Automatic system updates;ota_disable_automatic_update
Automatically capture system heap dumps;automatic_system_server_heap_dumps
Automatically select network;auto_select_key
Automatically sync data;auto_sync_account_data
Available;storage_settings_memory_available
Back up my data;backup_data
Background check;background_check
Background process limit;app_process_limit
Backup;Backup
Backup;privacy_settings_screen
Backup account;configure_account
Baseband version;base_band
Battery;power_usage_summary_screen
Battery;top_level_battery
Battery Saver;battery_saver
Battery Saver;battery_saver_summary
Battery optimization;high_power_apps
Battery percentage;battery_percentage
Battery usage;power_usage_advanced_screen
Blink light;notification_pulse
Bluetooth;bluetooth_switchbar_screen
Bluetooth AVRCP Version;bluetooth_select_avrcp_version
Bluetooth Audio Bits Per Sample;bluetooth_select_a2dp_bits_per_sample
Bluetooth Audio Channel Mode;bluetooth_select_a2dp_channel_mode
Bluetooth Audio Codec;bluetooth_select_a2dp_codec
Bluetooth Audio LDAC Codec: Playback Quality;bluetooth_select_a2dp_ldac_playback_quality
Bluetooth Audio Sample Rate;bluetooth_select_a2dp_sample_rate
Bluetooth address;bt_address
Bluetooth scanning;bluetooth_always_scanning
Bluetooth tethering;enable_bluetooth_tethering
Brightness level;brightness
Bubbles;notification_bubbles
Bug report;bugreport
Bug report shortcut;bugreport_in_power
Build number;build_number
Build number;os_build_number
CA certificate;install_ca_certificate
CDMA subscription;cdma_subscription_key
Call volume;call_volume
Calls;zen_mode_behavior_calls
Calls;zen_mode_calls_settings_page
Calls preference;calls_preference
Camera Laser Sensor;camera_laser_sensor_switch
Camera access needed;adaptive_sleep_permission
Camera permissions;enterprise_privacy_number_camera_access_packages
Caption preferences;captioning_preference_screen
Capture system heap dump;system_server_heap_dump
Cards & passes;gesture_global_actions_panel_summary
Carrier settings;carrier_settings_key
Carrier video calling;video_calling_key
Cast;wifi_display_settings_screen
Cast volume;remote_volume
Charging sounds and vibration;charging_sounds
Choose network;choose_network_key
Clear credentials;credentials_reset
Color correction;daltonizer_preference
Color correction;daltonizer_preference_screen
Color inversion;toggle_inversion_preference
Colors;color_mode
Colors;color_mode_settings_screen
Connect to open networks;use_open_wifi_automatically
Connected devices;connected_devices_screen
Connected devices;top_level_connected_devices
Connection preferences;connected_devices_advanced_screen
Connection preferences;connection_preferences
Contact search;contacts_search
Convert to file encryption;convert_to_file_encryption
Cool color temperature;color_temperature
Copyright;copyright
Correction mode;type
Cross-profile calendar;cross_profile_calendar
Current screen saver;current_screensaver
Custom;zen_custom
Custom restrictions;zen_mode_block_settings_page
Dark theme;dark_ui_mode
Data Saver;data_saver_screen
Data Saver;restrict_background_parent_entry
Data associated with your work account, such as email and calendar;enterprise_privacy_enterprise_data
Data during calls;data_during_calls
Data limit;data_limit
Data warning;data_warning
Data warning & limit;billing_cycle_settings
Data warning & limit;billing_preference
Date;date
Date & time;date_time_settings
Date & time;date_time_settings_screen
Debug GPU overdraw;debug_hw_overdraw
Debug non-rectangular clip operations;show_non_rect_clip
Default;accessibility_control_timeout_default
Default USB configuration;default_usb_configuration
Default alarm sound;alarm_ringtone
Default apps;default_apps
Default apps;number_enterprise_set_default_apps
Default duration;zen_mode_duration_settings
Default for work;autofill_work_app_defaults
Default keyboard;input_method
Default notification sound;notification_default_ringtone
Default notification sound;notification_ringtone
Default work alarm sound;work_alarm_ringtone
Default work notification sound;work_notification_ringtone
Delay before click;autoclick_delay
Desktop backup password;local_backup_password
Developer options;development_prefs_screen
Device Wi-Fi MAC address;wifi_mac_address
Device admin apps;device_admin_settings
Device admin apps;device_administrators
Device admin apps;manage_device_admin
Device name;device_name
Device theme;theme
Dial pad tones;dial_pad_tones
Disable Bluetooth A2DP hardware offload;bluetooth_disable_a2dp_hw_offload
Disable HW overlays;disable_overlays
Disable USB audio routing;usb_audio
Disable absolute volume;bluetooth_disable_absolute_volume
Disabled by admin;backup_inactive
Display;display_settings_screen
Display;top_level_display
Display cutout;display_cutout_emulation
Display over other apps;system_alert_window_app_list
Display size;screen_zoom_settings
Do Not Disturb;zen_mode
Do Not Disturb;zen_mode_notifications
Do Not Disturb;zen_mode_toggle
Do Not Disturb access;zen_access
Do Not Disturb access;zen_access_screen
Dock speaker plays;dock_audio_media
Docking sounds;docking_sounds
Don't blink light;zen_effect_light
Don't pop notifications on screen;zen_effect_peek
Don't turn on screen;zen_effect_intent
Don't wake for notifications;zen_effect_ambient
Dont keep activities;immediately_destroy_activities
Double twist for camera;camera_gesture
Double-tap to check phone;ambient_display_double_tap
Double-tap to check phone;gesture_double_tap_screen
Double-tap to check phone;gesture_double_tap_screen_input_summary
Dwell timing;autoclick_preference
Dwell timing;autoclick_preference_screen
Emergency alerts;app_and_notif_cell_broadcast_settings
Emergency dialing signal;emergency_tone
Emergency information;emergency_info
Enable Bluetooth HCI snoop log;bt_hci_snoop_log
Enable GPU debug layers;enable_gpu_debug_layers
Enable Wi-Fi Verbose Logging;wifi_verbose_logging
Enable for all apps;graphics_driver_all_apps_preference
Enable freeform windows;enable_freeform_support
Enable view attribute inspection;debug_view_attributes
Encrypt phone;encryption_and_credentials_encryption_status
Encryption & credentials;encryption_and_credential
Encryption & credentials;encryption_and_credentials_screen
End time;night_display_end_time
Equipment ID;fcc_equipment_id
Erase SIM;erase_sim
Erase all data (factory reset);factory_reset
Exceptions;zen_mode_sound_vibration_settings_page
Face unlock;face_settings
Face unlock;face_settings_profile
Face unlock;security_settings_face_settings_page
Failed password attempts before deleting all device data;failed_password_wipe_current_user
Failed password attempts before deleting work profile data;failed_password_wipe_managed_profile
Feature flags;feature_flags_settings
Files;pref_files
Files received via Bluetooth;bt_received_files
Flash screen;flash
Flashlight;flashlight
Flip camera;gesture_double_twist
Flip camera;gesture_double_twist_input_summary
Font size;font_size
Font size;font_size_setting_screen
Force 4x MSAA;force_msaa
Force RTL layout direction;force_rtl_layout_all_locales
Force activities to be resizable;force_resizable_activities
Force allow apps on external;force_allow_on_external
Force desktop mode;force_desktop_mode_on_external_displays
Force full GNSS measurements;enable_gnss_raw_meas_full_tracking
Free up space;storage_settings_free_space
Graphics Driver Preferences;graphics_driver_settings
Games;pref_games
Gestures;gesture_settings
Gestures;gesture_settings_screen
Global HTTP proxy set;global_http_proxy
Google Account;branded_account
Google Play system update;module_version
Google Play system update licenses;module_license
HDCP checking;hdcp_checking
Hardware version;hardware_info_device_revision
Hearing aids;hearing_aid_preference
Hide from pull-down shade;zen_effect_list
Hide notification dots on app icons;zen_effect_badge
Hide status bar icons at top of screen;zen_effect_status
High contrast text;toggle_high_text_contrast_preference
Hotspot & tethering;tether_prefs_screen
Hotspot & tethering;tether_settings
Hotspot name;wifi_tether_network_name
Hotspot password;wifi_tether_network_password
IMEI;imei_info
IP address;wifi_ip_address
Idle lock screen;aware_presence
Idle lock screen;aware_wake_display_page
Increase touch sensitivity;touch_sensitivity
Install a certificate;install_certificate
Install a certificate;install_certificate_from_storage
Install certificates;install_credentials
Install unknown apps;manage_external_sources
Instant Apps preferences;instant_app_web_action_pref
Instant apps;instant_app_web_action_toggle
Intensity;night_display_temperature
Internal shared storage;storage_settings_volume_private
Internal storage;storage_settings_internal_storage
Jump to camera;gesture_double_tap_power
Jump to camera;gesture_double_tap_power_input_summary
Kernel version;kernel_version
Keyboard shortcuts helper;keyboard_shortcuts_helper
Language;tts_default_lang
Languages;phone_language
Languages & input;language_and_input_settings_screen
Languages & input;language_input_settings
Large mouse pointer;toggle_large_pointer_icon
Last full charge;last_full_charge
Legal information;legal_screen
License;license
Lift to check phone;ambient_display_pick_up
Lift to check phone;gesture_pick_up
Lift to check phone;gesture_pick_up_input_summary
Lift to wake;lift_to_wake
List of apps on your device;enterprise_privacy_installed_packages
Live Caption;live_caption
Local terminal;enable_terminal
Location;location_settings
Location;top_level_location
Location for work profile;managed_profile_location_switch
Location permissions;enterprise_privacy_number_location_access_packages
Lock after screen timeout;lock_after_timeout
Lock device when unpinning;use_screen_lock
Lock screen;security_setting_lock_screen_notif
Lock screen display;lockscreen_from_display_settings
Lock screen display;security_lockscreen_settings_screen
Lock screen message;owner_info_settings
Logger buffer sizes;select_logd_size
Logging level;autofill_logging_level
MMS messages;mms_message
Magnification;magnification_preference_screen
Magnify with shortcut;screen_magnification_navbar_preference_screen
Magnify with triple-tap;screen_magnification_gestures_preference_screen
Make pattern visible;visiblepattern
Make profile pattern visible;visiblepattern_profile
Manage backup account;data_management
Manage keyboards;add_virtual_keyboard_screen
Manage keyboards;available_virtual_keyboard_page
Managed device info;enterprise_privacy
Managed device info;enterprise_privacy_settings
Manual;manual
Max requests per session;autofill_max_partitions
Max visible datasets;autofill_visible_datasets
Maximum connected Bluetooth audio devices;bluetooth_max_connected_audio_devices
Media volume;media_volume
Memory;memory
Microphone permissions;enterprise_privacy_number_microphone_access_packages
Mobile data;mobile_data_enable
Mobile data always active;mobile_data_always_on
Mobile network;mobile_network_list
Mobile network;mobile_network_list_screen
Mobile plan;manage_mobile_plan
Model;hardware_info_device_model
Model & hardware;device_model
Model & hardware;hardware_info_screen
Modify system settings;write_settings_apps
Mono audio;toggle_master_mono
Most recent bug report;bug_reports
Most recent network traffic log;network_logs
Most recent security log;security_logs
Motion Sense;aware_settings
Motion Sense;aware_toggle
Movie & TV apps;pref_movies
Multiple users;user_settings_screen
Music & audio;pref_music_audio
NFC;toggle_nfc
Network & internet;network_and_internet_screen
Network & internet;top_level_network
Network name;show_operator_name
Network rating provider;network_scorer_picker
New notifications;ambient_display_notification
Night Light;night_display_activated
Night Light tints your screen amber. This makes it easier to look at your screen or read in dim light, and may help you fall asleep more easily.;night_display_footer
No sound from notifications;zen_mute_notifications
No visuals or sound from notifications;zen_hide_notifications
Notification access;notification_access
Notification access;notification_access_screen
Notification vibration;notification_vibration_preference_screen
Notification volume;notification_volume
Notifications;all_notifications
Notifications;configure_notification_settings
Notifications on lockscreen;lock_screen_notifications
OEM unlocking;oem_unlock_enable
Open network notification;notify_open_networks
Opening links;manage_domain_url_screen
Other apps;pref_other_apps
Other files;storage_settings_misc_space
Override force-dark;hwui_force_dark
Pair new device;add_bt_devices
Payment default;nfc_payment
Permission manager;manage_perms
Permission manager;privacy_manage_perms
Personal dictionary;key_user_dictionary_settings
Personal dictionary;user_dict_list
Personal dictionary for work;user_dictionary_settings_for_work_pref
Personalize using app data;content_capture
Personalize using app data;content_capture_custom_settings
Phone number;phone_number
Phone ringtone;ringtone
Photos & videos;pref_photos_videos
Physical keyboard;physical_keyboard_screen
Picture color mode;picture_color_mode
Picture-in-picture;picture_in_picture
Picture-in-picture;picture_in_picture_screen
Pictures, videos;storage_settings_dcim_space
Pitch;tts_default_pitch
Pixel Imprint;fingerprint_settings
Pixel Imprint;fingerprint_settings_profile
Pixel uses Motion Sense to detect nearby movement. It does not use your camera, mic, or location.;wake_screen_gesture_footer
Play media sounds;zen_mode_media
Play media to;media_output
Pointer location;pointer_location
Pointer speed;pointer_speed
Power button ends call;toggle_power_button_ends_call_preference
Power button instantly locks;power_button_instantly_locks
Power on sounds;boot_sounds
Preferences;skip_gesture_footer
Preferred engine;tts_engine_picker_screen
Preferred network type;enabled_networks_key
Preferred network type;preferred_network_mode_key
Premium SMS access;premium_sms
Premium SMS access;premium_sms_screen
Prevent ringing;gesture_prevent_ringing_screen
Prevent ringing;gesture_prevent_ringing_summary
Previously connected devices;saved_device_list
Printing;print_settings_screen
Privacy;privacy_dashboard_page
Privacy;top_level_privacy
Private DNS;private_dns_settings
Profile HWUI rendering;track_frame_time
Quick settings developer tiles;development_tile_settings
Reach to check phone;ambient_display_wake_screen
Reach to check phone;gesture_wake_screen
Recent location requests;recent_location_requests_see_all
Recently opened apps;recent_open_apps
Redirect vibration;vibrate_input_devices
Regulatory labels;regulatory_info
Remove animations;toggle_disable_animations
Require eyes to be open;security_settings_face_require_attention
Reset ShortcutManager rate-limiting;reset_shortcut_manager_throttling
Reset Wi-Fi, mobile & Bluetooth;network_reset_pref
Reset app preferences;reset_app_prefs
Reset options;reset_dashboard
Reset options;reset_dashboard_fragment_screen
Reset to default values;autofill_reset_developer_options
Restrict notifications;zen_mode_block_effects_settings
Restrict notifications;zen_mode_restrict_settings_page
Restricted apps;restricted_app
Revoke USB debugging authorizations;clear_adb_keys
Ring & notification volume;ring_volume
Ring vibration;ring_vibration_preference_screen
Roaming;button_roaming_key
Running services;running_apps
SIM card lock;sim_lock_settings
SIM status;sim_status
SMS preference;sms_preference
SMS, MMS, and messaging apps;zen_mode_behavior_messages
SMS, MMS, and messaging apps;zen_mode_messages_settings_page
Safety & regulatory manual;safety_info
Schedule;night_display_auto_mode
Schedules;zen_mode_automation_settings
Schedules;zen_mode_automation_settings_page
Screen attention;adaptive_sleep
Screen attention;adaptive_sleep_entry
Screen lock;unlock_set_or_change
Screen locking sounds;screen_locking_sounds
Screen pinning;screen_pinning_settings
Screen pinning;screen_pinning_settings_screen
Screen saver;dream_overview_screen
Screen timeout;screen_timeout
Screen usage since full charge;screen_usage
Secure NFC;nfc_secure_settings
Security;security_dashboard_page
Security;top_level_security
Security;wifi_tether_security
See all;previously_connected_devices_see_all
See all exceptions;zen_sound_vibration_settings
See more;special_access_more
Select debug app;debug_app
Select mock location app;mock_location_app
Send feedback about this device;device_feedback
Sensitive notifications;lock_screen_redact
Sensitive work profile notifications;lock_screen_work_redact
Serial number;hardware_info_device_serial
Set a schedule;battery_saver_schedule
Set data limit;set_data_limit
Set data warning;set_data_warning
Set up data service;cdma_lte_data_service_key
Settings version;carrier_settings_version_key
Shortcut to prevent ringing;gesture_prevent_ringing_sound
Show Bluetooth devices without names;bluetooth_show_devices_without_names
Show background ANRs;show_all_anrs
Show cards & passes;gesture_global_actions_panel_switch
Show hardware layers updates;show_hw_layers_updates
Show layout bounds;debug_layout
Show lockdown option;security_setting_lockdown_enabled
Show notification channel warnings;show_notification_channel_warnings
Show passwords;show_password
Show surface updates;show_screen_updates
Show taps;show_touches
Show view updates;show_hw_screen_updates
Show virtual keyboard;show_virtual_keyboard_switch
Silence interruptions;gesture_silence
Silence interruptions;silence_gesture
Simulate color space;simulate_color_space
Simulate secondary displays;overlay_display_devices
Skip lock screen;security_lockscreen_bypass
Skip songs;gesture_skip
Smallest width;density
Smart Storage;toggle_asm
Sound;sound_settings
Sound;top_level_sound
Special app access;special_access
Special app access;special_app_access_screen
Speech rate;tts_default_rate
Spell checker;spellcheckers_settings
Spell checker for work;spellcheckers_settings_for_work_pref
Squeeze for silence;gesture_assist_silence
Squeeze for your Assistant;gesture_assist
Squeeze sensitivity;gesture_assist_sensitivity
Standby apps;inactive_apps
Starred contacts;zen_mode_starred_contacts_callers
Starred contacts;zen_mode_starred_contacts_messages
Start time;night_display_start_time
Stay awake;keep_screen_on
Storage;storage_dashboard_screen
Storage;storage_settings
Storage;top_level_storage
Storage type;credential_storage_type
Store logger data persistently on device;select_logpersist
Strict mode enabled;strict_mode
Styles & wallpapers;wallpaper_type
Suggested actions and replies;asst_capabilities_actions_replies
Swipe direction;gesture_skip_direction
Swipe fingerprint;gesture_swipe_down_fingerprint_screen
Swipe fingerprint for notifications;gesture_swipe_down_fingerprint
Swipe fingerprint for notifications;gesture_swipe_down_fingerprint_input_summary
Swipe fingerprint for notifications;gesture_swipe_down_fingerprint_notifications
Switch to mobile data automatically;wifi_cellular_data_fallback
System;pref_system
System;system_dashboard_screen
System;top_level_system
System UI demo mode;demo_mode
System WebView License;webview_license
System navigation;gesture_system_navigation_input_summary
System navigation;gesture_system_navigation_input_summary_accessibility
System navigation;gesture_system_navigation_screen
System select;cdma_system_select_key
System updates;system_update_settings
Take call on;take_call_on_output
Tap & pay;default_payment_app
Tap & pay;nfc_payment_settings_screen
Tap to check phone;ambient_display_tap
Tap to check phone;gesture_tap
Tap to check phone;gesture_tap_screen_input_summary
Tap to take action;gesture_tap
Tap to wake;tap_to_wake
Terms and conditions;terms
Tethering hardware acceleration;tethering_hardware_offload
Text-to-speech output;tts_settings_preference
Text-to-speech output;tts_settings_screen
Time;time
Time to take action;accessibility_control_timeout_preference
Time to take action (Accessibility timeout);accessibility_control_timeout_preference_fragment
Time zone;timezone
Tips & support;support_dashboard_activity
Tips & support;top_level_support
Total space;storage_settings_memory_size
Touch & hold delay;select_long_press_timeout_preference
Touch feedback;touch_vibration_preference_screen
Touch sounds;touch_sounds
Touch vibration;vibrate_on_touch
Transition animation scale;transition_animation_scale
Trust agents;manage_trust_agents
Trust agents;trust_agents
Trusted credentials;trusted_credentials
Trusted credentials in your personal profile;ca_certs_current_user
Trusted credentials in your work profile;ca_certs_managed_profile
Turn off hotspot automatically;wifi_tether_auto_turn_off
Turn off when fully charged;battery_saver_sticky
Turn on Bluetooth to connect to other devices.;discoverable_footer
Turn on Wi-Fi automatically;enable_wifi_wakeup
USB Preferences;usb_details_fragment
USB debugging;enable_adb
USB tethering;usb_tether_settings
Unlocking your phone;security_settings_face_keyguard
Unrestricted data;data_saver
Unrestricted data;unrestricted_access
Unrestricted data;unrestricted_data_screen
Up time;up_time
Usage access;special_app_usage_access
Use 24-hour format;24 hour
Use Battery Manager;auto_restriction
Use default;nfc_foreground
Use locale default;auto_24hour
Use network-provided time;auto_time
Use network-provided time zone;auto_zone
Use one lock;unification
Use personal profile sounds;work_use_personal_sounds
Use screenshot;screenshot
Use text from screen;context
User credentials;user_credentials
VPN;vpn_settings
VPN & app user certificate;install_user_certificate
VR helper services;enabled_vr_listeners
VR helper services;vr_listener_settings
Verify apps over USB;verify_apps_over_usb
Verify bytecode of debuggable apps;art_verifier_for_debuggable
Vibrate for calls;vibrate_when_ringing
Vibration & haptic strength;accessibility_settings_vibration_screen
Vibration & haptic strength;vibration_preference_screen
Virtual keyboard;virtual_keyboard_category
Virtual keyboard;virtual_keyboard_pref
Virtual keyboard for work;virtual_keyboards_for_work_pref
VoLTE;enhanced_4g_lte
Voice input;voice_input_settings
Volume key shortcut;accessibility_shortcut_preference
Wait for debugger;wait_for_debugger
Wallpaper;wallpaper
Wallpapers;wallpaper_attributions
WebView implementation;select_webview_provider
When there are multiple graphics drivers, you can pick to use the updated graphics driver for Apps installed on the device.;graphics_driver_footer
When device is in VR;vr_display_pref
When to start;when_to_start
Wi-Fi;main_toggle_wifi
Wi-Fi;toggle_wifi
Wi-Fi Direct;wifi_direct
Wi-Fi MAC address;saved_accesspoints_wifi_mac_address
Wi-Fi and Bluetooth scanning;location_scanning
Wi-Fi and Bluetooth scanning;scanning_screen
Wi-Fi calling;wifi_calling
Wi-Fi certificate;install_wifi_certificate
Wi-Fi control;change_wifi_state
Wi-Fi hotspot;wifi_tether
Wi-Fi preferences;wifi_configure_settings_screen
Wi-Fi scan throttling;wifi_scan_throttling
Wi-Fi scanning;wifi_always_scanning
Window animation scale;window_animation_scale
Wireless display certification;wifi_display_certification
Work phone ringtone;work_ringtone
Work profile;work_mode
Work profile lock;unlock_set_or_change_profile
Work profile settings;managed_profile_settings_screen
Work profile sounds;sound_work_settings_section
Your work policy info;work_policy_info
 ;accessibility_control_timeout_video
 ;adaptive_sleep_video
 ;auto_awesome_battery
 ;auto_brightness_video
 ;aware_settings_video
 ;battery_header
 ;battery_tip
 ;bt_nearby_slice
 ;notification_model_illustration
 ;security_settings_face_video
 ;use_sim_switch

View File

@@ -1,99 +0,0 @@
/*
* Copyright (C) 2018 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.ui.search;
import android.text.TextUtils;
import java.util.Objects;
/**
* Data class for {@link SettingsSearchResultRegressionTest}
*/
public class SearchData {
public final String title;
public final String key;
public String getTitle() {
return title;
}
public String getKey() {
return key;
}
public static final String DELIM = ";";
public static SearchData from(String searchDataString) {
String[] split = searchDataString.trim().split(DELIM, -1);
if (split.length != 2) {
throw new IllegalArgumentException("Arg is invalid: " + searchDataString);
}
return new SearchData.Builder()
.setTitle(split[0])
.setKey(split[1])
.build();
}
@Override
public String toString() {
return title + DELIM + key;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof SearchData)) {
return false;
}
SearchData other = (SearchData) obj;
return TextUtils.equals(this.title, other.title)
&& TextUtils.equals(this.key, other.key);
}
@Override
public int hashCode() {
return Objects.hash(title, key);
}
private SearchData(
SearchData.Builder builder) {
this.title = builder.title;
this.key = builder.key;
}
public static class Builder {
protected String title = "";
protected String key = "";
public SearchData build() {
return new SearchData(this);
}
public SearchData.Builder setTitle(String title) {
this.title = title;
return this;
}
public SearchData.Builder setKey(String key) {
this.key = key;
return this;
}
}
}

View File

@@ -1,233 +0,0 @@
/*
* Copyright (C) 2018 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.ui.search;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.database.Cursor;
import android.net.Uri;
import android.platform.test.annotations.Presubmit;
import android.text.TextUtils;
import android.util.Log;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@SmallTest
@RunWith(AndroidJUnit4.class)
public class SettingsSearchResultRegressionTest {
private static final String TAG = "SearchRegressionTest";
private Context mContext;
public interface IndexColumns {
String DATA_TITLE = "data_title";
String DATA_KEY_REF = "data_key_reference";
}
private static final String ERROR_RESULTS_MISSING =
"\nSettings search results missing. \n"
+ "If the changes are intentional, we want to update the master-list.\n";
private static final String ERROR_NEW_RESULTS =
"\nNew settings search results have been found.\nIf the changes are intentional, we "
+ "want to"
+ "prevent the new results from regressing.\n";
private static final String ERROR_RERUN_TEST =
"Please re-run the test \"generate_search_result_list\" by removing the '@Ignore' "
+ "annotation above 'generate_search_result_list' test, and run: \n"
+ "$ atest SettingsSearchResultRegressionTest.java \n"
+ "and copy the output into "
+ "'packages/apps/Settings/tests/uitests/assets/search_result_list'\n";
@Before
public void setUp() {
mContext = InstrumentationRegistry.getContext();
}
/**
* Tests that the set of search results does not regress.
* <p>
* The data set used here (/tests/unit/assets/search_results_list) needs to be updated
* every once in a while so that we can check newly added results.
* </p>
*/
@Test
@Presubmit
public void searchResultsDoNotRegress() {
final ContentResolver resolver = mContext.getContentResolver();
final Uri uri = getTestProviderUri();
if (uri == null) {
Log.e(TAG, "Something is wrong getting test provider uri, skipping");
return;
}
final Cursor cursor = resolver.query(uri, null, null, null, null);
if (cursor == null) {
// Assume Settings Intelligence is wrong.
return;
}
final Set<SearchData> availableSearchResults = getSearchDataFromCursor(cursor);
final Set<SearchData> registeredSearchResults = getRegisteredResults();
// Seed with results that we expect
final Set<SearchData> missingSearchResults = new HashSet<>(registeredSearchResults);
// Seed with results that are available
final Set<SearchData> newSearchResults = new HashSet<>(availableSearchResults);
// Remove all available results, leaving results that have been removed.
missingSearchResults.removeAll(availableSearchResults);
// Remove all results we expect, leaving results that have not yet been registered.
newSearchResults.removeAll(registeredSearchResults);
assertWithMessage(ERROR_RESULTS_MISSING + ERROR_RERUN_TEST)
.that(missingSearchResults).isEmpty();
assertWithMessage(ERROR_NEW_RESULTS + ERROR_RERUN_TEST).that(newSearchResults).isEmpty();
}
// TODO (b/113907111) add a test to catch duplicate title search results.
/**
* Test to generate a new list of search results. Uncomment the Test annotation and run the
* test to generate the list.
*/
@Ignore
@Test
public void generate_search_result_list() {
final ContentResolver resolver = mContext.getContentResolver();
final Uri uri = getTestProviderUri();
if (uri == null) {
Log.e(TAG, "Something is wrong getting test provider uri, skipping");
return;
}
final Cursor cursor = resolver.query(uri, null, null, null, null);
final List<SearchData> availableSearchResults =
new ArrayList<>(getSearchDataFromCursor(cursor));
Collections.sort(availableSearchResults, Comparator.comparing(SearchData::getTitle)
.thenComparing(SearchData::getKey));
assertThat(generateListFromSearchData(availableSearchResults)).isNull();
}
private Set<SearchData> getSearchDataFromCursor(Cursor cursor) {
final Set<SearchData> searchData = new HashSet<>();
final int titleIndex = cursor.getColumnIndex(
IndexColumns.DATA_TITLE);
final int keyIndex = cursor.getColumnIndex(
IndexColumns.DATA_KEY_REF);
while (cursor.moveToNext()) {
String title = cursor.getString(titleIndex);
String key = cursor.getString(keyIndex);
if (TextUtils.isEmpty(title)) {
title = "";
}
if (TextUtils.isEmpty(key)) {
key = "";
}
searchData.add(new SearchData.Builder()
.setTitle(title)
.setKey(key)
.build());
}
return searchData;
}
/**
* Utility method to generate the list of search results that this class uses to validate
* results.
*/
private String generateListFromSearchData(List<SearchData> searchData) {
StringBuilder builder = new StringBuilder();
for (SearchData searchResult : searchData) {
builder.append(searchResult.title)
.append(
SearchData.DELIM)
.append(searchResult.key)
.append("\n");
}
return builder.toString();
}
private Uri getTestProviderUri() {
final Intent providerIntent = new Intent("com.android.settings.intelligence.DUMP_INDEX");
final List<ResolveInfo> info = mContext.getPackageManager().queryIntentContentProviders(
providerIntent, 0 /* flags */);
if (info.size() != 1) {
Log.e(TAG, "Unexpected number of DUMP_INDEX providers, skipping. Expected 1, Found "
+ info.size());
return null;
}
return new Uri.Builder()
.scheme(ContentResolver.SCHEME_CONTENT)
.authority(info.get(0).providerInfo.authority)
.build();
}
private Set<SearchData> getRegisteredResults() {
final String filename = "search_results_list";
final Set<SearchData> registeredResults = new HashSet<>();
try {
final InputStream in = mContext.getAssets().open(filename);
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = reader.readLine()) != null) {
registeredResults.add(
SearchData.from(line));
}
} catch (Exception e) {
throw new IllegalArgumentException("Error initializing registered result list "
+ filename, e);
}
return registeredResults;
}
}