Snap for 6374617 from d9f883293c to mainline-release
Change-Id: I991e2b5a9b11a42d6acd298ab8d63226026e82e4
This commit is contained in:
@@ -99,10 +99,12 @@
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/verifying_textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/adb_wireless_item_progress_text"
|
||||
android:text="@string/adb_wireless_verifying_qrcode_text"/>
|
||||
android:text="@string/adb_wireless_verifying_qrcode_text"
|
||||
android:accessibilityLiveRegion="polite"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="48dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
@@ -23,12 +24,6 @@
|
||||
android:orientation="vertical"
|
||||
android:background="?android:attr/selectableItemBackground">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="48dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="6dp">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@*android:dimen/status_bar_icon_size"
|
||||
@@ -84,6 +79,4 @@
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification"
|
||||
android:textAlignment="viewStart" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -16,44 +16,44 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="6dp"
|
||||
android:paddingTop="6dp"
|
||||
android:minHeight="48dp"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:orientation="vertical"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
>
|
||||
|
||||
<RelativeLayout
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
android:minHeight="@*android:dimen/status_bar_icon_size"
|
||||
android:paddingBottom="6dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="@*android:dimen/status_bar_icon_size"
|
||||
android:layout_height="@*android:dimen/status_bar_icon_size"
|
||||
android:layout_width="@*android:dimen/status_bar_icon_size"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toEndOf="@+id/pkgicon"
|
||||
android:layout_marginStart="0dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:contentDescription="@null"
|
||||
android:adjustViewBounds="true"
|
||||
android:tint="?android:attr/textColorPrimary"
|
||||
android:maxHeight="@*android:dimen/status_bar_icon_size"
|
||||
android:maxWidth="@*android:dimen/status_bar_icon_size"
|
||||
android:scaleType="fitCenter" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/pkgname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toEndOf="@id/icon"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:marqueeRepeatLimit = "marquee_forever"
|
||||
android:scrollHorizontally = "true"
|
||||
android:textStyle="bold"
|
||||
android:textAlignment="viewStart" />
|
||||
|
||||
@@ -66,7 +66,6 @@
|
||||
android:paddingTop="1dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:visibility="gone"
|
||||
android:layout_toEndOf="@id/pkgname"
|
||||
android:tint="?android:attr/textColorSecondary"
|
||||
android:src="@drawable/ic_notifications_alert"
|
||||
/>
|
||||
@@ -87,8 +86,7 @@
|
||||
android:id="@+id/timestamp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="13dp"
|
||||
android:paddingBottom="13dp"
|
||||
android:minHeight="@*android:dimen/status_bar_icon_size"
|
||||
android:layout_alignBottom="@android:id/widget_frame"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignTop="@android:id/widget_frame"
|
||||
@@ -98,13 +96,12 @@
|
||||
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification"
|
||||
android:textAlignment="viewEnd"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:minHeight="48dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
>
|
||||
|
||||
@@ -3017,6 +3017,10 @@
|
||||
<item quantity="one">Incorrect SIM PIN code, you have <xliff:g id="number">%d</xliff:g> remaining attempt before you must contact your carrier to unlock your device.</item>
|
||||
<item quantity="other">Incorrect SIM PIN code, you have <xliff:g id="number">%d</xliff:g> remaining attempts.</item>
|
||||
</plurals>
|
||||
|
||||
<!-- This is instruction text to inform the user that they have entered the wrong SIM PIN while trying to unlock the keyguard.
|
||||
The variable will be replaced with a number. [CHAR LIMIT=NONE] -->
|
||||
<string name="wrong_pin_code_one">Incorrect SIM PIN code, you have 1 remaining attempt before you must contact your carrier to unlock your device.</string>
|
||||
<!-- Instructions telling the user that the operation to unlock the keyguard with SIM PIN failed. Displayed in one line in a large font. [CHAR LIMIT=40] -->
|
||||
<string name="pin_failed">SIM PIN operation failed!</string>
|
||||
|
||||
@@ -4941,17 +4945,11 @@
|
||||
<!-- Summary for accessibility shortcut preference for software shortcut type. [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_shortcut_edit_dialog_title_software">Tap accessibility button</string>
|
||||
<!-- Summary for software shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_shortcut_edit_dialog_summary_software">Tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> at the bottom of your screen</string>
|
||||
<string name="accessibility_shortcut_edit_dialog_summary_software">Tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> at the bottom of your screen.\n\nTo switch between features, touch & hold the accessibility button.</string>
|
||||
<!-- Summary for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation is enabled. [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_shortcut_edit_dialog_summary_software_gesture">Swipe up from the bottom of the screen with 2 fingers</string>
|
||||
<string name="accessibility_shortcut_edit_dialog_summary_software_gesture">Swipe up from the bottom of the screen with 2 fingers.\n\nTo switch between features, swipe up with 2 fingers and hold.</string>
|
||||
<!-- Summary for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_shortcut_edit_dialog_summary_software_gesture_talkback">Swipe up from the bottom of the screen with 3 fingers</string>
|
||||
<!-- Summary for software shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_shortcut_edit_dialog_summary_migration_software">Tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> at the bottom of your screen.\n\nTo switch between features, touch & hold the accessibility button.</string>
|
||||
<!-- Summary for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation is enabled. [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_shortcut_edit_dialog_summary_migration_software_gesture">Swipe up from the bottom of the screen with 2 fingers.\n\nTo switch between features, swipe up with 2 fingers and hold.</string>
|
||||
<!-- Summary for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_shortcut_edit_dialog_summary_migration_software_gesture_talkback">Swipe up from the bottom of the screen with 3 fingers.\n\nTo switch between features, swipe up with 3 fingers and hold.</string>
|
||||
<string name="accessibility_shortcut_edit_dialog_summary_software_gesture_talkback">Swipe up from the bottom of the screen with 3 fingers.\n\nTo switch between features, swipe up with 3 fingers and hold.</string>
|
||||
<!-- Title for hardware shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_shortcut_edit_dialog_title_hardware">Hold volume keys</string>
|
||||
<!-- Summary for hardware shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
|
||||
@@ -5144,30 +5142,20 @@
|
||||
<!-- Summary shown for tritanomaly (blue-yellow color blindness) [CHAR LIMIT=45] -->
|
||||
<string name="daltonizer_mode_tritanomaly_summary">Blue-yellow</string>
|
||||
|
||||
<!-- Subtitle for the accessibility preference to configure feature that performs click action soon after mouse/trackpad pointer stops moving, in case delay before click is extremely short. Placeholder will be set to the number of milliseconds to which the delay amounts. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="accessibilty_autoclick_preference_subtitle_extremely_short_delay">
|
||||
<item quantity="one">Extremely short delay (<xliff:g id="click_delay_label" example="200">%1$s</xliff:g> second)</item>
|
||||
<item quantity="other">Extremely short delay (<xliff:g id="click_delay_label" example="200">%1$s</xliff:g> seconds)</item>
|
||||
</plurals>
|
||||
<!-- Subtitle for the accessibility preference to configure feature that performs click action soon after mouse/trackpad pointer stops moving, in case delay before click is extremely short. Placeholder will be set to the number of milliseconds to which the delay amounts. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="accessibilty_autoclick_preference_subtitle_very_short_delay">
|
||||
<item quantity="one">Very short delay (<xliff:g id="click_delay_label" example="200">%1$s</xliff:g> second)</item>
|
||||
<item quantity="other">Very short delay (<xliff:g id="click_delay_label" example="200">%1$s</xliff:g> seconds)</item>
|
||||
</plurals>
|
||||
<!-- Subtitle for the accessibility preference to configure feature that performs click action soon after mouse/trackpad pointer stops moving, in case delay before click is extremely short. Placeholder will be set to the number of milliseconds to which the delay amounts. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="accessibilty_autoclick_preference_subtitle_short_delay">
|
||||
<item quantity="one">Short delay (<xliff:g id="click_delay_label" example="200">%1$s</xliff:g> second)</item>
|
||||
<item quantity="other">Short delay (<xliff:g id="click_delay_label" example="200">%1$s</xliff:g> seconds)</item>
|
||||
<item quantity="one">Short (<xliff:g id="click_delay_label" example="200">%1$s</xliff:g> second)</item>
|
||||
<item quantity="other">Short (<xliff:g id="click_delay_label" example="200">%1$s</xliff:g> seconds)</item>
|
||||
</plurals>
|
||||
<!-- Subtitle for the accessibility preference to configure feature that performs click action soon after mouse/trackpad pointer stops moving, in case delay before click is extremely short. Placeholder will be set to the number of milliseconds to which the delay amounts. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="accessibilty_autoclick_preference_subtitle_medium_delay">
|
||||
<item quantity="one">Medium (<xliff:g id="click_delay_label" example="200">%1$s</xliff:g> second)</item>
|
||||
<item quantity="other">Medium (<xliff:g id="click_delay_label" example="200">%1$s</xliff:g> seconds)</item>
|
||||
</plurals>
|
||||
<!-- Subtitle for the accessibility preference to configure feature that performs click action soon after mouse/trackpad pointer stops moving, in case delay before click is extremely short. Placeholder will be set to the number of milliseconds to which the delay amounts. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="accessibilty_autoclick_preference_subtitle_long_delay">
|
||||
<item quantity="one">Long delay (<xliff:g id="click_delay_label" example="200">%1$s</xliff:g> second)</item>
|
||||
<item quantity="other">Long delay (<xliff:g id="click_delay_label" example="200">%1$s</xliff:g> seconds)</item>
|
||||
</plurals>
|
||||
<!-- Subtitle for the accessibility preference to configure feature that performs click action soon after mouse/trackpad pointer stops moving, in case delay before click is extremely short. Placeholder will be set to the number of milliseconds to which the delay amounts. [CHAR LIMIT=NONE] -->
|
||||
<plurals name="accessibilty_autoclick_preference_subtitle_very_long_delay">
|
||||
<item quantity="one">Very long delay (<xliff:g id="click_delay_label" example="200">%1$s</xliff:g> second)</item>
|
||||
<item quantity="other">Very long delay (<xliff:g id="click_delay_label" example="200">%1$s</xliff:g> seconds)</item>
|
||||
<item quantity="one">Long (<xliff:g id="click_delay_label" example="200">%1$s</xliff:g> second)</item>
|
||||
<item quantity="other">Long (<xliff:g id="click_delay_label" example="200">%1$s</xliff:g> seconds)</item>
|
||||
</plurals>
|
||||
|
||||
<!-- Summary for autoclick seekbar settings preference when user selected custom item. [CHAR LIMIT=35] -->
|
||||
@@ -7187,6 +7175,8 @@
|
||||
<string name="help_url_caption" translatable="false"></string>
|
||||
<!-- Help URL, Accessibility Timeout [DO NOT TRANSLATE] -->
|
||||
<string name="help_url_timeout" translatable="false"></string>
|
||||
<!-- Help URL, Accessibility Color Inversion [DO NOT TRANSLATE] -->
|
||||
<string name="help_url_color_inversion" translatable="false"></string>
|
||||
<string name="help_url_system_dashboard" translatable="false"></string>
|
||||
<string name="help_url_double_tap_screen" translatable="false"></string>
|
||||
<string name="help_url_account_detail" translatable="false"></string>
|
||||
@@ -10667,7 +10657,7 @@
|
||||
<string name="legacy_navigation_summary">Go back, Home, and switch apps with buttons at the bottom of your screen.</string>
|
||||
|
||||
<!-- Search keywords for System Navigation settings. [CHAR_LIMIT=NONE]-->
|
||||
<string name="keywords_system_navigation">system navigation, 2 button navigation, 3 button navigation, gesture navigation</string>
|
||||
<string name="keywords_system_navigation">system navigation, 2 button navigation, 3 button navigation, gesture navigation, swipe</string>
|
||||
|
||||
<!-- Message for the alert dialog which says that the current default home app does not support gesture navigation. [CHAR LIMIT=NONE] -->
|
||||
<string name="gesture_not_supported_dialog_message">Not supported by your default home app, <xliff:g id="default_home_app" example="Pixel Launcher">%s</xliff:g></string>
|
||||
|
||||
@@ -577,6 +577,11 @@
|
||||
android:title="@string/show_notification_channel_warnings"
|
||||
android:summary="@string/show_notification_channel_warnings_summary" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="enforce_shortcuts_for_conversations"
|
||||
android:title="@string/enforce_shortcuts_for_conversations"
|
||||
android:summary="@string/enforce_shortcuts_for_conversations_summary" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="asst_capability_prioritizer"
|
||||
android:title="@string/asst_capability_prioritizer_title"
|
||||
|
||||
@@ -51,7 +51,8 @@
|
||||
android:key="gesture_system_navigation_input_summary"
|
||||
android:title="@string/system_navigation_title"
|
||||
android:fragment="com.android.settings.gestures.SystemNavigationGestureSettings"
|
||||
settings:controller="com.android.settings.gestures.SystemNavigationPreferenceController" />
|
||||
settings:controller="com.android.settings.gestures.SystemNavigationPreferenceController"
|
||||
settings:keywords="@string/keywords_system_navigation" />
|
||||
|
||||
<Preference
|
||||
android:key="gesture_tap_screen_input_summary"
|
||||
|
||||
@@ -91,8 +91,12 @@ public class AllInOneTetherSettings extends RestrictedDashboardFragment
|
||||
|
||||
private static final String KEY_DATA_SAVER_FOOTER = "disabled_on_data_saver" + DEDUP_POSTFIX;
|
||||
private static final String KEY_WIFI_TETHER_GROUP = "wifi_tether_settings_group";
|
||||
private static final int EXPANDED_CHILD_COUNT_WITH_SECURITY_NON = 2;
|
||||
private static final int EXPANDED_CHILD_COUNT_DEFAULT = 3;
|
||||
@VisibleForTesting
|
||||
static final int EXPANDED_CHILD_COUNT_DEFAULT = 3;
|
||||
@VisibleForTesting
|
||||
static final int EXPANDED_CHILD_COUNT_WITH_SECURITY_NON = 2;
|
||||
@VisibleForTesting
|
||||
static final int EXPANDED_CHILD_COUNT_WITHOUT_WIFI_CONFIG = 3;
|
||||
private static final String TAG = "AllInOneTetherSettings";
|
||||
|
||||
private boolean mUnavailable;
|
||||
@@ -120,7 +124,6 @@ public class AllInOneTetherSettings extends RestrictedDashboardFragment
|
||||
mUsbTethering = TetherEnabler.isUsbTethering(state);
|
||||
mWifiTethering = TetherEnabler.isWifiTethering(state);
|
||||
mWifiTetherGroup.setVisible(shouldShowWifiConfig());
|
||||
reConfigInitialExpandedChildCount();
|
||||
};
|
||||
|
||||
private final BroadcastReceiver mTetherChangeReceiver = new BroadcastReceiver() {
|
||||
@@ -354,10 +357,6 @@ public class AllInOneTetherSettings extends RestrictedDashboardFragment
|
||||
mRestartWifiApAfterConfigChange = true;
|
||||
mTetherEnabler.stopTethering(TETHERING_WIFI);
|
||||
}
|
||||
|
||||
if (controller instanceof WifiTetherSecurityPreferenceController) {
|
||||
reConfigInitialExpandedChildCount();
|
||||
}
|
||||
}
|
||||
|
||||
private SoftApConfiguration buildNewConfig() {
|
||||
@@ -384,15 +383,10 @@ public class AllInOneTetherSettings extends RestrictedDashboardFragment
|
||||
return mWifiTethering || (!mBluetoothTethering && !mUsbTethering);
|
||||
}
|
||||
|
||||
private void reConfigInitialExpandedChildCount() {
|
||||
getPreferenceScreen().setInitialExpandedChildrenCount(getInitialExpandedChildCount());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInitialExpandedChildCount() {
|
||||
if (!shouldShowWifiConfig()) {
|
||||
// Expand all preferences in the screen.
|
||||
return getPreferenceScreen().getPreferenceCount();
|
||||
return EXPANDED_CHILD_COUNT_WITHOUT_WIFI_CONFIG;
|
||||
}
|
||||
|
||||
if (mSecurityPreferenceController == null) {
|
||||
|
||||
@@ -639,7 +639,9 @@ public class IccLockSettings extends SettingsPreferenceFragment
|
||||
|
||||
if (attemptsRemaining == 0) {
|
||||
displayMessage = mRes.getString(R.string.wrong_pin_code_pukked);
|
||||
} else if (attemptsRemaining > 0) {
|
||||
} else if (attemptsRemaining == 1) {
|
||||
displayMessage = mRes.getString(R.string.wrong_pin_code_one, attemptsRemaining);
|
||||
} else if (attemptsRemaining > 1) {
|
||||
displayMessage = mRes
|
||||
.getQuantityString(R.plurals.wrong_pin_code, attemptsRemaining,
|
||||
attemptsRemaining);
|
||||
|
||||
@@ -105,7 +105,7 @@ public class CaptionAppearanceFragment extends SettingsPreferenceFragment
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.ACCESSIBILITY_CAPTION_PROPERTIES;
|
||||
return SettingsEnums.ACCESSIBILITY_CAPTION_APPEARANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,7 +44,7 @@ public class CaptionMoreOptionsFragment extends SettingsPreferenceFragment
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.ACCESSIBILITY_CAPTION_PROPERTIES;
|
||||
return SettingsEnums.ACCESSIBILITY_CAPTION_MORE_OPTIONS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -64,12 +64,10 @@ public class ToggleAutoclickPreferenceFragment extends DashboardFragment
|
||||
* Resource ids from which autoclick preference summaries should be derived. The strings have
|
||||
* placeholder for integer delay value.
|
||||
*/
|
||||
private static final int[] mAutoclickPreferenceSummaries = {
|
||||
R.plurals.accessibilty_autoclick_preference_subtitle_extremely_short_delay,
|
||||
R.plurals.accessibilty_autoclick_preference_subtitle_very_short_delay,
|
||||
private static final int[] AUTOCLICK_PREFERENCE_SUMMARIES = {
|
||||
R.plurals.accessibilty_autoclick_preference_subtitle_short_delay,
|
||||
R.plurals.accessibilty_autoclick_preference_subtitle_long_delay,
|
||||
R.plurals.accessibilty_autoclick_preference_subtitle_very_long_delay
|
||||
R.plurals.accessibilty_autoclick_preference_subtitle_medium_delay,
|
||||
R.plurals.accessibilty_autoclick_preference_subtitle_long_delay
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -86,7 +84,7 @@ public class ToggleAutoclickPreferenceFragment extends DashboardFragment
|
||||
// Only show integer when delay time is 1.
|
||||
final String decimalFormat = (delaySecond == 1) ? "%.0f" : "%.1f";
|
||||
|
||||
return resources.getQuantityString(mAutoclickPreferenceSummaries[summaryIndex],
|
||||
return resources.getQuantityString(AUTOCLICK_PREFERENCE_SUMMARIES[summaryIndex],
|
||||
quantity, String.format(decimalFormat, delaySecond));
|
||||
}
|
||||
|
||||
@@ -98,10 +96,10 @@ public class ToggleAutoclickPreferenceFragment extends DashboardFragment
|
||||
return 0;
|
||||
}
|
||||
if (delay >= MAX_AUTOCLICK_DELAY_MS) {
|
||||
return mAutoclickPreferenceSummaries.length - 1;
|
||||
return AUTOCLICK_PREFERENCE_SUMMARIES.length - 1;
|
||||
}
|
||||
int delayRange = MAX_AUTOCLICK_DELAY_MS - MIN_AUTOCLICK_DELAY_MS;
|
||||
int rangeSize = (delayRange) / (mAutoclickPreferenceSummaries.length - 1);
|
||||
int rangeSize = (delayRange) / (AUTOCLICK_PREFERENCE_SUMMARIES.length - 1);
|
||||
return (delay - MIN_AUTOCLICK_DELAY_MS) / rangeSize;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,11 @@ public class ToggleColorInversionPreferenceFragment extends ToggleFeaturePrefere
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHelpResource() {
|
||||
return R.string.help_url_color_inversion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSettingsClicked(ShortcutPreference preference) {
|
||||
super.onSettingsClicked(preference);
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.android.settings.applications;
|
||||
|
||||
import android.app.Application;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.app.usage.UsageStats;
|
||||
import android.content.Context;
|
||||
import android.icu.text.RelativeDateTimeFormatter;
|
||||
@@ -98,12 +97,12 @@ public class RecentAppsPreferenceController extends BasePreferenceController
|
||||
.setHeaderTitleRes(R.string.recent_app_category_title)
|
||||
.setHeaderDetailsClickListener((View v) -> {
|
||||
mMetricsFeatureProvider.logClickedPreference(mRecentAppsPreference,
|
||||
SettingsEnums.SETTINGS_APP_NOTIF_CATEGORY);
|
||||
getMetricsCategory());
|
||||
new SubSettingLauncher(mContext)
|
||||
.setDestination(ManageApplications.class.getName())
|
||||
.setArguments(null /* arguments */)
|
||||
.setTitleRes(R.string.application_info_label)
|
||||
.setSourceMetricsCategory(SettingsEnums.SETTINGS_APP_NOTIF_CATEGORY)
|
||||
.setSourceMetricsCategory(getMetricsCategory())
|
||||
.launch();
|
||||
});
|
||||
}
|
||||
@@ -166,11 +165,10 @@ public class RecentAppsPreferenceController extends BasePreferenceController
|
||||
RelativeDateTimeFormatter.Style.SHORT))
|
||||
.setOnClickListener(v -> {
|
||||
mMetricsFeatureProvider.logClickedPreference(mRecentAppsPreference,
|
||||
SettingsEnums.SETTINGS_APP_NOTIF_CATEGORY);
|
||||
getMetricsCategory());
|
||||
AppInfoBase.startAppInfoFragment(AppInfoDashboardFragment.class,
|
||||
R.string.application_info_label, pkgName, appEntry.info.uid,
|
||||
mHost, 1001 /*RequestCode*/,
|
||||
SettingsEnums.SETTINGS_APP_NOTIF_CATEGORY);
|
||||
mHost, 1001 /*RequestCode*/, getMetricsCategory());
|
||||
})
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||
@@ -202,8 +201,7 @@ public class DeviceAdminListPreferenceController extends BasePreferenceControlle
|
||||
pref.setSummary(item.getDescription());
|
||||
pref.setEnabled(item.isEnabled());
|
||||
pref.setOnPreferenceClickListener(preference -> {
|
||||
mMetricsFeatureProvider.logClickedPreference(preference,
|
||||
preference.getExtras().getInt(DashboardFragment.CATEGORY));
|
||||
mMetricsFeatureProvider.logClickedPreference(preference, getMetricsCategory());
|
||||
final UserHandle user = item.getUser();
|
||||
mContext.startActivityAsUser(item.getLaunchIntent(mContext), user);
|
||||
return true;
|
||||
|
||||
@@ -124,6 +124,7 @@ public abstract class BasePreferenceController extends AbstractPreferenceControl
|
||||
private boolean mIsForWork;
|
||||
@Nullable
|
||||
private UserHandle mWorkProfileUser;
|
||||
private int mMetricsCategory;
|
||||
|
||||
/**
|
||||
* Instantiate a controller as specified controller type and user-defined key.
|
||||
@@ -398,11 +399,27 @@ public abstract class BasePreferenceController extends AbstractPreferenceControl
|
||||
* This won't block UI thread however has similar side effect. Please use it if you
|
||||
* want to avoid janky animation(i.e. new preference is added in the middle of page).
|
||||
*
|
||||
* This music be used in {@link BasePreferenceController}
|
||||
* This must be used in {@link BasePreferenceController}
|
||||
*/
|
||||
public interface UiBlocker {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the metrics category of the parent fragment.
|
||||
*
|
||||
* Called by DashboardFragment#onAttach
|
||||
*/
|
||||
public void setMetricsCategory(int metricsCategory) {
|
||||
mMetricsCategory = metricsCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the metrics category of the parent fragment.
|
||||
*/
|
||||
protected int getMetricsCategory() {
|
||||
return mMetricsCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Non-{@code null} {@link UserHandle} when a work profile is enabled.
|
||||
* Otherwise {@code null}.
|
||||
|
||||
@@ -18,8 +18,10 @@ import android.content.Context;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.slices.SliceData;
|
||||
import com.android.settings.widget.MasterSwitchPreference;
|
||||
import com.android.settings.widget.TwoStateButtonPreference;
|
||||
|
||||
/**
|
||||
* Abstract class that consolidates logic for updating toggle controllers.
|
||||
@@ -54,6 +56,8 @@ public abstract class TogglePreferenceController extends BasePreferenceControlle
|
||||
((TwoStatePreference) preference).setChecked(isChecked());
|
||||
} else if (preference instanceof MasterSwitchPreference) {
|
||||
((MasterSwitchPreference) preference).setChecked(isChecked());
|
||||
} else if (preference instanceof TwoStateButtonPreference) {
|
||||
((TwoStateButtonPreference) preference).setChecked(isChecked());
|
||||
} else {
|
||||
refreshSummary(preference);
|
||||
}
|
||||
@@ -61,6 +65,12 @@ public abstract class TogglePreferenceController extends BasePreferenceControlle
|
||||
|
||||
@Override
|
||||
public final boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
// TwoStatePreference is a regular preference and can be handled by DashboardFragment
|
||||
if (preference instanceof MasterSwitchPreference
|
||||
|| preference instanceof TwoStateButtonPreference) {
|
||||
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider()
|
||||
.logClickedPreference(preference, getMetricsCategory());
|
||||
}
|
||||
return setChecked((boolean) newValue);
|
||||
}
|
||||
|
||||
|
||||
@@ -113,6 +113,14 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
|
||||
}
|
||||
});
|
||||
|
||||
// Set metrics category for BasePreferenceController.
|
||||
final int metricCategory = getMetricsCategory();
|
||||
mControllers.forEach(controller -> {
|
||||
if (controller instanceof BasePreferenceController) {
|
||||
((BasePreferenceController) controller).setMetricsCategory(metricCategory);
|
||||
}
|
||||
});
|
||||
|
||||
mPlaceholderPreferenceController =
|
||||
new DashboardTilePlaceholderPreferenceController(context);
|
||||
mControllers.add(mPlaceholderPreferenceController);
|
||||
|
||||
@@ -73,6 +73,7 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen
|
||||
private QrDecorateView mDecorateView;
|
||||
private View mQrCameraView;
|
||||
private View mVerifyingView;
|
||||
private TextView mVerifyingTextView;
|
||||
private TextView mErrorMessage;
|
||||
|
||||
/** QR code data scanned by camera */
|
||||
@@ -168,6 +169,7 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen
|
||||
|
||||
mQrCameraView = view.findViewById(R.id.camera_layout);
|
||||
mVerifyingView = view.findViewById(R.id.verifying_layout);
|
||||
mVerifyingTextView = view.findViewById(R.id.verifying_textview);
|
||||
|
||||
setHeaderTitle(R.string.wifi_dpp_scan_qr_code);
|
||||
mSummary.setText(R.string.adb_wireless_qrcode_pairing_description);
|
||||
@@ -207,6 +209,15 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen
|
||||
super.onAttach(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
getActivity().getActionBar().hide();
|
||||
// setTitle for TalkBack
|
||||
getActivity().setTitle(R.string.wifi_dpp_scan_qr_code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return 0;
|
||||
@@ -264,6 +275,8 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen
|
||||
mDecorateView.setFocused(true);
|
||||
mQrCameraView.setVisibility(View.GONE);
|
||||
mVerifyingView.setVisibility(View.VISIBLE);
|
||||
AdbQrCode.triggerVibrationForQrCodeRecognition(getContext());
|
||||
mVerifyingTextView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
|
||||
try {
|
||||
mAdbManager.enablePairingByQrCode(mAdbConfig.getSsid(),
|
||||
mAdbConfig.getPreSharedKey());
|
||||
|
||||
@@ -501,6 +501,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|
||||
controllers.add(new ShowFirstCrashDialogPreferenceController(context));
|
||||
controllers.add(new AppsNotRespondingPreferenceController(context));
|
||||
controllers.add(new NotificationChannelWarningsPreferenceController(context));
|
||||
controllers.add(new EnforceConversationShortcutsPreferenceController(context));
|
||||
controllers.add(new AllowAppsOnExternalPreferenceController(context));
|
||||
controllers.add(new ResizableActivityPreferenceController(context));
|
||||
controllers.add(new FreeformWindowsPreferenceController(context));
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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.development;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
|
||||
public class EnforceConversationShortcutsPreferenceController extends
|
||||
DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener,
|
||||
PreferenceControllerMixin {
|
||||
|
||||
private static final String KEY =
|
||||
"enforce_shortcuts_for_conversations";
|
||||
|
||||
@VisibleForTesting
|
||||
final static int SETTING_VALUE_ON = 1;
|
||||
@VisibleForTesting
|
||||
final static int SETTING_VALUE_OFF = 0;
|
||||
|
||||
final static int DEFAULT_VALUE = SETTING_VALUE_OFF;
|
||||
|
||||
public EnforceConversationShortcutsPreferenceController(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
final boolean isEnabled = (Boolean) newValue;
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.REQUIRE_SHORTCUTS_FOR_CONVERSATIONS,
|
||||
isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.REQUIRE_SHORTCUTS_FOR_CONVERSATIONS, DEFAULT_VALUE);
|
||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@
|
||||
package com.android.settings.display;
|
||||
|
||||
import android.app.UiModeManager;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -33,8 +32,6 @@ import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.TogglePreferenceController;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||
import com.android.settingslib.core.lifecycle.events.OnStart;
|
||||
import com.android.settingslib.core.lifecycle.events.OnStop;
|
||||
@@ -49,7 +46,6 @@ public class DarkUIPreferenceController extends TogglePreferenceController imple
|
||||
@VisibleForTesting
|
||||
Preference mPreference;
|
||||
|
||||
private final MetricsFeatureProvider mMetricsFeatureProvider;
|
||||
private UiModeManager mUiModeManager;
|
||||
private PowerManager mPowerManager;
|
||||
private Context mContext;
|
||||
@@ -68,7 +64,6 @@ public class DarkUIPreferenceController extends TogglePreferenceController imple
|
||||
mContext = context;
|
||||
mUiModeManager = context.getSystemService(UiModeManager.class);
|
||||
mPowerManager = context.getSystemService(PowerManager.class);
|
||||
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,7 +86,6 @@ public class DarkUIPreferenceController extends TogglePreferenceController imple
|
||||
|
||||
@Override
|
||||
public boolean setChecked(boolean isChecked) {
|
||||
mMetricsFeatureProvider.logClickedPreference(mPreference, SettingsEnums.DISPLAY);
|
||||
final boolean dialogSeen =
|
||||
Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.DARK_MODE_DIALOG_SEEN, 0) == DIALOG_SEEN;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.display;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.hardware.display.ColorDisplayManager;
|
||||
import android.text.TextUtils;
|
||||
@@ -50,8 +49,7 @@ public class NightDisplayActivationPreferenceController extends TogglePreference
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mButtonTriggered = true;
|
||||
mMetricsFeatureProvider.logClickedPreference(mPreference,
|
||||
SettingsEnums.NIGHT_DISPLAY_SETTINGS);
|
||||
mMetricsFeatureProvider.logClickedPreference(mPreference, getMetricsCategory());
|
||||
mColorDisplayManager.setNightDisplayActivated(
|
||||
!mColorDisplayManager.isNightDisplayActivated());
|
||||
updateStateInternal();
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.android.settings.display.darkmode;
|
||||
|
||||
import android.app.UiModeManager;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.PowerManager;
|
||||
@@ -136,8 +135,7 @@ public class DarkModeActivationPreferenceController extends BasePreferenceContro
|
||||
private final View.OnClickListener mListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mMetricsFeatureProvider.logClickedPreference(mPreference,
|
||||
SettingsEnums.DARK_UI_SETTINGS);
|
||||
mMetricsFeatureProvider.logClickedPreference(mPreference, getMetricsCategory());
|
||||
final boolean active = (mContext.getResources().getConfiguration().uiMode
|
||||
& Configuration.UI_MODE_NIGHT_YES) != 0;
|
||||
mUiModeManager.setNightModeActivated(!active);
|
||||
|
||||
@@ -16,21 +16,17 @@
|
||||
|
||||
package com.android.settings.fuelgauge.batterysaver;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.PowerManager;
|
||||
import android.provider.SettingsSlicesContract;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.core.TogglePreferenceController;
|
||||
import com.android.settings.fuelgauge.BatterySaverReceiver;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.widget.TwoStateButtonPreference;
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||
import com.android.settingslib.core.lifecycle.events.OnStart;
|
||||
import com.android.settingslib.core.lifecycle.events.OnStop;
|
||||
@@ -45,13 +41,11 @@ public class BatterySaverButtonPreferenceController extends
|
||||
|
||||
private final BatterySaverReceiver mBatterySaverReceiver;
|
||||
private final PowerManager mPowerManager;
|
||||
private final MetricsFeatureProvider mMetricsFeatureProvider;
|
||||
|
||||
private TwoStateButtonPreference mPreference;
|
||||
|
||||
public BatterySaverButtonPreferenceController(Context context, String key) {
|
||||
super(context, key);
|
||||
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
|
||||
mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
mBatterySaverReceiver = new BatterySaverReceiver(context);
|
||||
mBatterySaverReceiver.setBatterySaverListener(this);
|
||||
@@ -100,21 +94,11 @@ public class BatterySaverButtonPreferenceController extends
|
||||
|
||||
@Override
|
||||
public boolean setChecked(boolean stateOn) {
|
||||
mMetricsFeatureProvider.logClickedPreference(mPreference,
|
||||
SettingsEnums.FUELGAUGE_BATTERY_SAVER);
|
||||
// This screen already shows a warning, so we don't need another warning.
|
||||
return BatterySaverUtils.setPowerSaveMode(mContext, stateOn,
|
||||
false /* needFirstTimeWarning */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
super.updateState(preference);
|
||||
if (mPreference != null) {
|
||||
mPreference.setChecked(isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPowerSaveModeChanged() {
|
||||
final boolean isChecked = isChecked();
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.network.telephony;
|
||||
|
||||
|
||||
import android.telephony.TelephonyManager;
|
||||
|
||||
/**
|
||||
@@ -210,6 +209,12 @@ public class TelephonyConstants {
|
||||
* Copied from {@link android.telephony.RadioAccessFamily}
|
||||
*/
|
||||
public static class RadioAccessFamily {
|
||||
/**
|
||||
* TODO: get rid of RAF definition in RadioAccessFamily and
|
||||
* use {@link TelephonyManager.NetworkTypeBitMask}
|
||||
* TODO: public definition {@link TelephonyManager.NetworkTypeBitMask} is long.
|
||||
* TODO: Convert from int * to long everywhere including HAL definitions.
|
||||
*/
|
||||
// 2G
|
||||
public static final int RAF_UNKNOWN = (int) TelephonyManager.NETWORK_TYPE_BITMASK_UNKNOWN;
|
||||
public static final int RAF_GSM = (int) TelephonyManager.NETWORK_TYPE_BITMASK_GSM;
|
||||
@@ -245,9 +250,7 @@ public class TelephonyConstants {
|
||||
public static final int WCDMA = HS | RAF_UMTS;
|
||||
// 4G
|
||||
public static final int LTE = RAF_LTE | RAF_LTE_CA;
|
||||
|
||||
// 5G
|
||||
public static final int NR = RAF_NR;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.notification.history;
|
||||
|
||||
import android.app.PendingIntent;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.UserHandle;
|
||||
@@ -91,10 +92,14 @@ public class NotificationSbnViewHolder extends RecyclerView.ViewHolder {
|
||||
Slog.e(TAG, "Could not launch", e);
|
||||
}
|
||||
} else {
|
||||
Intent appIntent = new Intent(Intent.ACTION_MAIN)
|
||||
.setPackage(pkg);
|
||||
Intent appIntent = itemView.getContext().getPackageManager()
|
||||
.getLaunchIntentForPackage(pkg);
|
||||
appIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
try {
|
||||
itemView.getContext().startActivityAsUser(appIntent, UserHandle.of(userId));
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Slog.e(TAG, "no launch activity", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
ViewCompat.setAccessibilityDelegate(itemView, new AccessibilityDelegateCompat() {
|
||||
|
||||
@@ -1304,9 +1304,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
|
||||
final WifiManager wifiManager = context.getSystemService(WifiManager.class);
|
||||
final List<AccessPoint> accessPoints = WifiSavedConfigUtils.getAllConfigs(
|
||||
context, wifiManager);
|
||||
if (accessPoints == null || accessPoints.size() <= 0) {
|
||||
if (WifiSavedConfigUtils.getAllConfigsCount(context, wifiManager) == 0) {
|
||||
keys.add(PREF_KEY_SAVED_NETWORKS);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ import com.android.settingslib.RestrictedLockUtilsInternal;
|
||||
import com.android.settingslib.search.Indexable;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
import com.android.settingslib.wifi.LongPressWifiEntryPreference;
|
||||
import com.android.settingslib.wifi.WifiSavedConfigUtils;
|
||||
import com.android.wifitrackerlib.WifiEntry;
|
||||
import com.android.wifitrackerlib.WifiEntry.ConnectCallback;
|
||||
import com.android.wifitrackerlib.WifiPickerTracker;
|
||||
@@ -1027,7 +1028,22 @@ public class WifiSettings2 extends RestrictedSettingsFragment
|
||||
};
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.wifi_settings2);
|
||||
new BaseSearchIndexProvider(R.xml.wifi_settings2) {
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
|
||||
final WifiManager wifiManager = context.getSystemService(WifiManager.class);
|
||||
if (WifiSavedConfigUtils.getAllConfigsCount(context, wifiManager) == 0) {
|
||||
keys.add(PREF_KEY_SAVED_NETWORKS);
|
||||
}
|
||||
|
||||
if (!DataUsageUtils.hasWifiRadio(context)) {
|
||||
keys.add(PREF_KEY_DATA_USAGE);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
|
||||
private class WifiEntryConnectCallback implements ConnectCallback {
|
||||
final WifiEntry mConnectWifiEntry;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.android.settings.wifi.dpp;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
/**
|
||||
@@ -53,4 +54,13 @@ public class AdbQrCode extends WifiQrCode {
|
||||
public WifiNetworkConfig getAdbNetworkConfig() {
|
||||
return mAdbConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers a vibration to notify of a valid QR code.
|
||||
*
|
||||
* @param context The context to use
|
||||
*/
|
||||
public static void triggerVibrationForQrCodeRecognition(Context context) {
|
||||
WifiDppUtils.triggerVibrationForQrCodeRecognition(context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import static com.android.settings.AllInOneTetherSettings.EXPANDED_CHILD_COUNT_DEFAULT;
|
||||
import static com.android.settings.AllInOneTetherSettings.EXPANDED_CHILD_COUNT_WITHOUT_WIFI_CONFIG;
|
||||
import static com.android.settings.AllInOneTetherSettings.EXPANDED_CHILD_COUNT_WITH_SECURITY_NON;
|
||||
import static com.android.settings.network.TetherEnabler.BLUETOOTH_TETHER_KEY;
|
||||
import static com.android.settings.network.TetherEnabler.USB_TETHER_KEY;
|
||||
import static com.android.settings.network.TetherEnabler.WIFI_TETHER_DISABLE_KEY;
|
||||
@@ -29,6 +32,7 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.wifi.SoftApConfiguration;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.util.FeatureFlagUtils;
|
||||
@@ -36,6 +40,7 @@ import android.util.FeatureFlagUtils;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.testutils.shadow.ShadowWifiManager;
|
||||
import com.android.settings.wifi.tether.WifiTetherAutoOffPreferenceController;
|
||||
import com.android.settings.wifi.tether.WifiTetherSecurityPreferenceController;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -65,6 +70,8 @@ public class AllInOneTetherSettingsTest {
|
||||
private ConnectivityManager mConnectivityManager;
|
||||
@Mock
|
||||
private UserManager mUserManager;
|
||||
@Mock
|
||||
private WifiTetherSecurityPreferenceController mSecurityPreferenceController;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
@@ -82,6 +89,8 @@ public class AllInOneTetherSettingsTest {
|
||||
|
||||
mAllInOneTetherSettings = new AllInOneTetherSettings();
|
||||
ReflectionHelpers.setField(mAllInOneTetherSettings, "mLifecycle", mock(Lifecycle.class));
|
||||
ReflectionHelpers.setField(mAllInOneTetherSettings, "mSecurityPreferenceController",
|
||||
mSecurityPreferenceController);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -157,6 +166,32 @@ public class AllInOneTetherSettingsTest {
|
||||
.isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getInitialExpandedChildCount_shouldShowWifiConfigWithSecurity() {
|
||||
ReflectionHelpers.setField(mAllInOneTetherSettings, "mWifiTethering", true);
|
||||
when(mSecurityPreferenceController.getSecurityType())
|
||||
.thenReturn(SoftApConfiguration.SECURITY_TYPE_WPA2_PSK);
|
||||
assertThat(mAllInOneTetherSettings.getInitialExpandedChildCount())
|
||||
.isEqualTo(EXPANDED_CHILD_COUNT_DEFAULT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getInitialExpandedChildCount_shouldShowWifiConfigWithoutSecurity() {
|
||||
ReflectionHelpers.setField(mAllInOneTetherSettings, "mWifiTethering", true);
|
||||
when(mSecurityPreferenceController.getSecurityType())
|
||||
.thenReturn(SoftApConfiguration.SECURITY_TYPE_OPEN);
|
||||
assertThat(mAllInOneTetherSettings.getInitialExpandedChildCount())
|
||||
.isEqualTo(EXPANDED_CHILD_COUNT_WITH_SECURITY_NON);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getInitialExpandedChildCount_shouldNotShowWifiConfig() {
|
||||
ReflectionHelpers.setField(mAllInOneTetherSettings, "mWifiTethering", false);
|
||||
ReflectionHelpers.setField(mAllInOneTetherSettings, "mBluetoothTethering", true);
|
||||
assertThat(mAllInOneTetherSettings.getInitialExpandedChildCount())
|
||||
.isEqualTo(EXPANDED_CHILD_COUNT_WITHOUT_WIFI_CONFIG);
|
||||
}
|
||||
|
||||
private void setupIsTetherAvailable(boolean returnValue) {
|
||||
when(mConnectivityManager.isTetheringSupported()).thenReturn(true);
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
@@ -205,6 +206,15 @@ public class BasePreferenceControllerTest {
|
||||
assertThat(keys).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMetricsCategory_metricsCategoryIsSet_shouldReturnTheSameCategory() {
|
||||
mPreferenceController.setMetricsCategory(SettingsEnums.DISPLAY);
|
||||
|
||||
final int category = mPreferenceController.getMetricsCategory();
|
||||
|
||||
assertThat(category).isEqualTo(SettingsEnums.DISPLAY);
|
||||
}
|
||||
|
||||
private class FakeBasePreferenceController extends BasePreferenceController {
|
||||
|
||||
private int mAvailable;
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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.development;
|
||||
|
||||
import static com.android.settings.development.EnforceConversationShortcutsPreferenceController.SETTING_VALUE_OFF;
|
||||
import static com.android.settings.development.EnforceConversationShortcutsPreferenceController.SETTING_VALUE_ON;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class EnforceConversationShortcutsPreferenceControllerTest {
|
||||
|
||||
@Mock
|
||||
private SwitchPreference mPreference;
|
||||
@Mock
|
||||
private PreferenceScreen mScreen;
|
||||
|
||||
private Context mContext;
|
||||
private EnforceConversationShortcutsPreferenceController mController;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mController = new EnforceConversationShortcutsPreferenceController(mContext);
|
||||
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
|
||||
mController.displayPreference(mScreen);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_settingEnabled() {
|
||||
mController.onPreferenceChange(mPreference, true /* new value */);
|
||||
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.REQUIRE_SHORTCUTS_FOR_CONVERSATIONS, -1 /* default */);
|
||||
|
||||
assertThat(mode).isEqualTo(SETTING_VALUE_ON);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_settingDisabled() {
|
||||
mController.onPreferenceChange(mPreference, false /* new value */);
|
||||
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.REQUIRE_SHORTCUTS_FOR_CONVERSATIONS, -1 /* default */);
|
||||
|
||||
assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_settingEnabled_preferenceShouldBeChecked() {
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.REQUIRE_SHORTCUTS_FOR_CONVERSATIONS,
|
||||
SETTING_VALUE_ON);
|
||||
|
||||
mController.updateState(mPreference);
|
||||
|
||||
verify(mPreference).setChecked(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_settingDisabled_preferenceShouldNotBeChecked() {
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.REQUIRE_SHORTCUTS_FOR_CONVERSATIONS, SETTING_VALUE_OFF);
|
||||
|
||||
mController.updateState(mPreference);
|
||||
|
||||
verify(mPreference).setChecked(false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user