Snap for 12140224 from d0333eb674 to 24Q4-release
Change-Id: Icb9a4e4727d38dd5703f20221402276ebab049e9
This commit is contained in:
@@ -15,8 +15,10 @@
|
|||||||
~ limitations under the License.
|
~ limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
<solid android:color="?android:colorButtonNormal" />
|
<solid android:color="?androidprv:attr/colorAccentPrimary" />
|
||||||
<corners android:radius="12dp" />
|
<corners android:radius="12dp" />
|
||||||
</shape>
|
</shape>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
android:id="@+id/qrcode_view"
|
android:id="@+id/qrcode_view"
|
||||||
android:layout_width="@dimen/qrcode_size"
|
android:layout_width="@dimen/qrcode_size"
|
||||||
android:layout_height="@dimen/qrcode_size"
|
android:layout_height="@dimen/qrcode_size"
|
||||||
android:contentDescription="@string/audio_streams_qr_code_page_image_label"
|
android:contentDescription="@string/qr_code_content_description"
|
||||||
android:focusable="true" />
|
android:focusable="true" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
|
android:textColor="?androidprv:attr/textColorOnAccent"
|
||||||
android:background="@drawable/audio_sharing_rounded_bg_ripple"
|
android:background="@drawable/audio_sharing_rounded_bg_ripple"
|
||||||
android:textAlignment="center" />
|
android:textAlignment="center" />
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
android:id="@+id/qrcode_view"
|
android:id="@+id/qrcode_view"
|
||||||
android:layout_width="@dimen/qrcode_size"
|
android:layout_width="@dimen/qrcode_size"
|
||||||
android:layout_height="@dimen/qrcode_size"
|
android:layout_height="@dimen/qrcode_size"
|
||||||
android:contentDescription="@string/audio_streams_qr_code_page_image_label"
|
android:contentDescription="@string/qr_code_content_description"
|
||||||
android:focusable="true"/>
|
android:focusable="true"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|||||||
@@ -15,7 +15,9 @@
|
|||||||
~ limitations under the License.
|
~ limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:scrollbars="none">
|
android:scrollbars="none">
|
||||||
@@ -60,6 +62,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
|
android:textColor="?androidprv:attr/textColorOnAccent"
|
||||||
android:background="@drawable/audio_sharing_rounded_bg_ripple"
|
android:background="@drawable/audio_sharing_rounded_bg_ripple"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
@@ -70,6 +73,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
|
android:textColor="?androidprv:attr/textColorOnAccent"
|
||||||
android:background="@drawable/audio_sharing_rounded_bg_ripple"
|
android:background="@drawable/audio_sharing_rounded_bg_ripple"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -78,6 +78,8 @@
|
|||||||
|
|
||||||
<!-- Content description for preview pager. [CHAR LIMIT=NONE] -->
|
<!-- Content description for preview pager. [CHAR LIMIT=NONE] -->
|
||||||
<string name="preview_pager_content_description">Preview</string>
|
<string name="preview_pager_content_description">Preview</string>
|
||||||
|
<!-- Content description for qrcode image. [CHAR LIMIT=none]-->
|
||||||
|
<string name="qr_code_content_description">QR code</string>
|
||||||
|
|
||||||
<!-- Description for the button that makes interface elements smaller. [CHAR_LIMIT=NONE] -->
|
<!-- Description for the button that makes interface elements smaller. [CHAR_LIMIT=NONE] -->
|
||||||
<string name="font_size_make_smaller_desc">Make smaller</string>
|
<string name="font_size_make_smaller_desc">Make smaller</string>
|
||||||
@@ -1896,8 +1898,6 @@
|
|||||||
<!-- Nfc developer settings: The confirm button of the popup dialog. [CHAR_LIMIT=60] -->
|
<!-- Nfc developer settings: The confirm button of the popup dialog. [CHAR_LIMIT=60] -->
|
||||||
<string name="nfc_reboot_dialog_confirm">Restart</string>
|
<string name="nfc_reboot_dialog_confirm">Restart</string>
|
||||||
|
|
||||||
<!-- External Display settings. The keywords for searching. [CHAR LIMIT=40] -->
|
|
||||||
<string name="keywords_external_display">mirror, external display, connected display, usb display, resolution, rotation</string>
|
|
||||||
<!-- External Display settings. When external display is enabled. [CHAR LIMIT=40] -->
|
<!-- External Display settings. When external display is enabled. [CHAR LIMIT=40] -->
|
||||||
<string name="external_display_on">On</string>
|
<string name="external_display_on">On</string>
|
||||||
<!-- External Display settings. When external display is disabled. [CHAR LIMIT=40] -->
|
<!-- External Display settings. When external display is disabled. [CHAR LIMIT=40] -->
|
||||||
@@ -13762,8 +13762,6 @@
|
|||||||
<string name="audio_streams_main_page_qr_code_scanner_summary">Scan an audio stream QR code to listen with <xliff:g example="LE headset" id="device_name">%1$s</xliff:g></string>
|
<string name="audio_streams_main_page_qr_code_scanner_summary">Scan an audio stream QR code to listen with <xliff:g example="LE headset" id="device_name">%1$s</xliff:g></string>
|
||||||
<!-- Le audio streams password dialog [CHAR LIMIT=NONE] -->
|
<!-- Le audio streams password dialog [CHAR LIMIT=NONE] -->
|
||||||
<string name="audio_streams_main_page_password_dialog_cannot_edit">Can\u0027t edit password while sharing. To change the password, first turn off audio sharing.</string>
|
<string name="audio_streams_main_page_password_dialog_cannot_edit">Can\u0027t edit password while sharing. To change the password, first turn off audio sharing.</string>
|
||||||
<!-- Text for audio sharing qrcode image [CHAR LIMIT=none]-->
|
|
||||||
<string name="audio_streams_qr_code_page_image_label">QR code</string>
|
|
||||||
<!-- Text for audio sharing qrcode scanner [CHAR LIMIT=none]-->
|
<!-- Text for audio sharing qrcode scanner [CHAR LIMIT=none]-->
|
||||||
<string name="audio_streams_qr_code_scanner_label">QR code scanner</string>
|
<string name="audio_streams_qr_code_scanner_label">QR code scanner</string>
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,5 @@
|
|||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||||
settings:keywords="@string/keywords_external_display"
|
|
||||||
android:title="@string/external_display_settings_title">
|
android:title="@string/external_display_settings_title">
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|||||||
@@ -89,8 +89,7 @@ public class MainClearConfirm extends InstrumentedFragment {
|
|||||||
final PersistentDataBlockManager pdbManager;
|
final PersistentDataBlockManager pdbManager;
|
||||||
// pre-flight check hardware support PersistentDataBlockManager
|
// pre-flight check hardware support PersistentDataBlockManager
|
||||||
if (!SystemProperties.get(PERSISTENT_DATA_BLOCK_PROP).equals("")) {
|
if (!SystemProperties.get(PERSISTENT_DATA_BLOCK_PROP).equals("")) {
|
||||||
pdbManager = (PersistentDataBlockManager)
|
pdbManager = getActivity().getSystemService(PersistentDataBlockManager.class);
|
||||||
getActivity().getSystemService(Context.PERSISTENT_DATA_BLOCK_SERVICE);
|
|
||||||
} else {
|
} else {
|
||||||
pdbManager = null;
|
pdbManager = null;
|
||||||
}
|
}
|
||||||
@@ -152,6 +151,11 @@ public class MainClearConfirm extends InstrumentedFragment {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not try to erase factory reset protection data if the protection is alive.
|
||||||
|
if (pdbManager.isFactoryResetProtectionActive()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// The persistent data block will persist if the device is still being provisioned.
|
// The persistent data block will persist if the device is still being provisioned.
|
||||||
if (isDeviceStillBeingProvisioned()) {
|
if (isDeviceStillBeingProvisioned()) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -28,19 +28,30 @@ import com.android.settingslib.datastore.BackupRestoreStorageManager;
|
|||||||
/** Backup agent for Settings APK */
|
/** Backup agent for Settings APK */
|
||||||
public class SettingsBackupHelper extends BackupAgentHelper {
|
public class SettingsBackupHelper extends BackupAgentHelper {
|
||||||
public static final String SOUND_BACKUP_HELPER = "SoundSettingsBackup";
|
public static final String SOUND_BACKUP_HELPER = "SoundSettingsBackup";
|
||||||
|
public static final String ACCESSIBILITY_APPEARANCE_BACKUP_HELPER =
|
||||||
|
"AccessibilityAppearanceSettingsBackup";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
BackupRestoreStorageManager.getInstance(this).addBackupAgentHelpers(this);
|
BackupRestoreStorageManager.getInstance(this).addBackupAgentHelpers(this);
|
||||||
|
OnboardingFeatureProvider onboardingFeatureProvider =
|
||||||
|
FeatureFactory.getFeatureFactory().getOnboardingFeatureProvider();
|
||||||
|
|
||||||
if (Flags.enableSoundBackup()) {
|
if (Flags.enableSoundBackup()) {
|
||||||
OnboardingFeatureProvider onboardingFeatureProvider =
|
|
||||||
FeatureFactory.getFeatureFactory().getOnboardingFeatureProvider();
|
|
||||||
if (onboardingFeatureProvider != null) {
|
if (onboardingFeatureProvider != null) {
|
||||||
addHelper(SOUND_BACKUP_HELPER, onboardingFeatureProvider.
|
addHelper(SOUND_BACKUP_HELPER, onboardingFeatureProvider.
|
||||||
getSoundBackupHelper(this, this.getBackupRestoreEventLogger()));
|
getSoundBackupHelper(this, this.getBackupRestoreEventLogger()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Flags.accessibilityAppearanceSettingsBackupEnabled()) {
|
||||||
|
if (onboardingFeatureProvider != null) {
|
||||||
|
addHelper(ACCESSIBILITY_APPEARANCE_BACKUP_HELPER,
|
||||||
|
onboardingFeatureProvider.getAccessibilityAppearanceBackupHelper(
|
||||||
|
this, this.getBackupRestoreEventLogger()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -48,9 +48,6 @@ import com.android.settings.SettingsPreferenceFragmentBase;
|
|||||||
import com.android.settings.connecteddevice.display.ExternalDisplaySettingsConfiguration.DisplayListener;
|
import com.android.settings.connecteddevice.display.ExternalDisplaySettingsConfiguration.DisplayListener;
|
||||||
import com.android.settings.connecteddevice.display.ExternalDisplaySettingsConfiguration.Injector;
|
import com.android.settings.connecteddevice.display.ExternalDisplaySettingsConfiguration.Injector;
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
import com.android.settings.core.SubSettingLauncher;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
|
||||||
import com.android.settingslib.search.Indexable;
|
|
||||||
import com.android.settingslib.search.SearchIndexable;
|
|
||||||
import com.android.settingslib.widget.FooterPreference;
|
import com.android.settingslib.widget.FooterPreference;
|
||||||
import com.android.settingslib.widget.IllustrationPreference;
|
import com.android.settingslib.widget.IllustrationPreference;
|
||||||
import com.android.settingslib.widget.MainSwitchPreference;
|
import com.android.settingslib.widget.MainSwitchPreference;
|
||||||
@@ -63,12 +60,8 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* The Settings screen for External Displays configuration and connection management.
|
* The Settings screen for External Displays configuration and connection management.
|
||||||
*/
|
*/
|
||||||
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
|
public class ExternalDisplayPreferenceFragment extends SettingsPreferenceFragmentBase {
|
||||||
public class ExternalDisplayPreferenceFragment extends SettingsPreferenceFragmentBase
|
|
||||||
implements Indexable {
|
|
||||||
static final int EXTERNAL_DISPLAY_SETTINGS_RESOURCE = R.xml.external_display_settings;
|
static final int EXTERNAL_DISPLAY_SETTINGS_RESOURCE = R.xml.external_display_settings;
|
||||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
|
||||||
new BaseSearchIndexProvider(EXTERNAL_DISPLAY_SETTINGS_RESOURCE);
|
|
||||||
static final String DISPLAYS_LIST_PREFERENCE_KEY = "displays_list_preference";
|
static final String DISPLAYS_LIST_PREFERENCE_KEY = "displays_list_preference";
|
||||||
static final String EXTERNAL_DISPLAY_USE_PREFERENCE_KEY = "external_display_use_preference";
|
static final String EXTERNAL_DISPLAY_USE_PREFERENCE_KEY = "external_display_use_preference";
|
||||||
static final String EXTERNAL_DISPLAY_ROTATION_KEY = "external_display_rotation";
|
static final String EXTERNAL_DISPLAY_ROTATION_KEY = "external_display_rotation";
|
||||||
@@ -77,7 +70,7 @@ public class ExternalDisplayPreferenceFragment extends SettingsPreferenceFragmen
|
|||||||
R.string.external_display_change_resolution_footer_title;
|
R.string.external_display_change_resolution_footer_title;
|
||||||
static final int EXTERNAL_DISPLAY_LANDSCAPE_DRAWABLE =
|
static final int EXTERNAL_DISPLAY_LANDSCAPE_DRAWABLE =
|
||||||
R.drawable.external_display_mirror_landscape;
|
R.drawable.external_display_mirror_landscape;
|
||||||
static final int EXTERANAL_DISPLAY_TITLE_RESOURCE =
|
static final int EXTERNAL_DISPLAY_TITLE_RESOURCE =
|
||||||
R.string.external_display_settings_title;
|
R.string.external_display_settings_title;
|
||||||
static final int EXTERNAL_DISPLAY_USE_TITLE_RESOURCE =
|
static final int EXTERNAL_DISPLAY_USE_TITLE_RESOURCE =
|
||||||
R.string.external_display_use_title;
|
R.string.external_display_use_title;
|
||||||
@@ -332,7 +325,7 @@ public class ExternalDisplayPreferenceFragment extends SettingsPreferenceFragmen
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
activity.setTitle(EXTERANAL_DISPLAY_TITLE_RESOURCE);
|
activity.setTitle(EXTERNAL_DISPLAY_TITLE_RESOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showTextWhenNoDisplaysToShow(@NonNull final PreferenceScreen screen,
|
private void showTextWhenNoDisplaysToShow(@NonNull final PreferenceScreen screen,
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import static android.hardware.display.DisplayManager.EVENT_FLAG_DISPLAY_CONNECT
|
|||||||
import static android.hardware.display.DisplayManager.EVENT_FLAG_DISPLAY_REMOVED;
|
import static android.hardware.display.DisplayManager.EVENT_FLAG_DISPLAY_REMOVED;
|
||||||
import static android.view.Display.INVALID_DISPLAY;
|
import static android.view.Display.INVALID_DISPLAY;
|
||||||
|
|
||||||
|
import static com.android.server.display.feature.flags.Flags.enableModeLimitForExternalDisplay;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.hardware.display.DisplayManager;
|
import android.hardware.display.DisplayManager;
|
||||||
import android.hardware.display.DisplayManagerGlobal;
|
import android.hardware.display.DisplayManagerGlobal;
|
||||||
@@ -271,6 +273,13 @@ public class ExternalDisplaySettingsConfiguration {
|
|||||||
public void setUserPreferredDisplayMode(int displayId, @NonNull Mode mode) {
|
public void setUserPreferredDisplayMode(int displayId, @NonNull Mode mode) {
|
||||||
DisplayManagerGlobal.getInstance().setUserPreferredDisplayMode(displayId, mode);
|
DisplayManagerGlobal.getInstance().setUserPreferredDisplayMode(displayId, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the display mode limit flag enabled.
|
||||||
|
*/
|
||||||
|
public boolean isModeLimitForExternalDisplayEnabled() {
|
||||||
|
return enableModeLimitForExternalDisplay();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract static class DisplayListener implements DisplayManager.DisplayListener {
|
public abstract static class DisplayListener implements DisplayManager.DisplayListener {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class ResolutionPreferenceFragment extends SettingsPreferenceFragmentBase {
|
public class ResolutionPreferenceFragment extends SettingsPreferenceFragmentBase {
|
||||||
private static final String TAG = "ResolutionPreferenceFragment";
|
private static final String TAG = "ResolutionPreference";
|
||||||
static final int DEFAULT_LOW_REFRESH_RATE = 60;
|
static final int DEFAULT_LOW_REFRESH_RATE = 60;
|
||||||
static final String MORE_OPTIONS_KEY = "more_options";
|
static final String MORE_OPTIONS_KEY = "more_options";
|
||||||
static final String TOP_OPTIONS_KEY = "top_options";
|
static final String TOP_OPTIONS_KEY = "top_options";
|
||||||
@@ -60,6 +60,8 @@ public class ResolutionPreferenceFragment extends SettingsPreferenceFragmentBase
|
|||||||
R.string.external_display_more_options_title;
|
R.string.external_display_more_options_title;
|
||||||
static final int EXTERNAL_DISPLAY_RESOLUTION_SETTINGS_RESOURCE =
|
static final int EXTERNAL_DISPLAY_RESOLUTION_SETTINGS_RESOURCE =
|
||||||
R.xml.external_display_resolution_settings;
|
R.xml.external_display_resolution_settings;
|
||||||
|
static final String DISPLAY_MODE_LIMIT_OVERRIDE_PROP = "persist.sys.com.android.server.display"
|
||||||
|
+ ".feature.flags.enable_mode_limit_for_external_display-override";
|
||||||
@Nullable
|
@Nullable
|
||||||
private Injector mInjector;
|
private Injector mInjector;
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -323,16 +325,29 @@ public class ResolutionPreferenceFragment extends SettingsPreferenceFragmentBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isDisplayResolutionLimitEnabled() {
|
||||||
|
if (mInjector == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var flagOverride = mInjector.getSystemProperty(DISPLAY_MODE_LIMIT_OVERRIDE_PROP);
|
||||||
|
var isOverrideEnabled = "true".equals(flagOverride);
|
||||||
|
var isOverrideEnabledOrNotSet = !"false".equals(flagOverride);
|
||||||
|
return (mInjector.isModeLimitForExternalDisplayEnabled() && isOverrideEnabledOrNotSet)
|
||||||
|
|| isOverrideEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
private void updateDisplayModeLimits(@Nullable Context context) {
|
private void updateDisplayModeLimits(@Nullable Context context) {
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mExternalDisplayPeakRefreshRate = getResources(context).getInteger(
|
mExternalDisplayPeakRefreshRate = getResources(context).getInteger(
|
||||||
com.android.internal.R.integer.config_externalDisplayPeakRefreshRate);
|
com.android.internal.R.integer.config_externalDisplayPeakRefreshRate);
|
||||||
mExternalDisplayPeakWidth = getResources(context).getInteger(
|
if (isDisplayResolutionLimitEnabled()) {
|
||||||
|
mExternalDisplayPeakWidth = getResources(context).getInteger(
|
||||||
com.android.internal.R.integer.config_externalDisplayPeakWidth);
|
com.android.internal.R.integer.config_externalDisplayPeakWidth);
|
||||||
mExternalDisplayPeakHeight = getResources(context).getInteger(
|
mExternalDisplayPeakHeight = getResources(context).getInteger(
|
||||||
com.android.internal.R.integer.config_externalDisplayPeakHeight);
|
com.android.internal.R.integer.config_externalDisplayPeakHeight);
|
||||||
|
}
|
||||||
mRefreshRateSynchronizationEnabled = getResources(context).getBoolean(
|
mRefreshRateSynchronizationEnabled = getResources(context).getBoolean(
|
||||||
com.android.internal.R.bool.config_refreshRateSynchronizationEnabled);
|
com.android.internal.R.bool.config_refreshRateSynchronizationEnabled);
|
||||||
Log.d(TAG, "mExternalDisplayPeakRefreshRate=" + mExternalDisplayPeakRefreshRate);
|
Log.d(TAG, "mExternalDisplayPeakRefreshRate=" + mExternalDisplayPeakRefreshRate);
|
||||||
|
|||||||
@@ -45,9 +45,10 @@ public class BluetoothMaxConnectedAudioDevicesPreferenceController extends
|
|||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
final BluetoothManager bluetoothManager = context.getSystemService(BluetoothManager.class);
|
final BluetoothManager bluetoothManager = context.getSystemService(BluetoothManager.class);
|
||||||
|
if(bluetoothManager != null && bluetoothManager.getAdapter() != null) {
|
||||||
mDefaultMaxConnectedAudioDevices =
|
mDefaultMaxConnectedAudioDevices =
|
||||||
bluetoothManager.getAdapter().getMaxConnectedAudioDevices();
|
bluetoothManager.getAdapter().getMaxConnectedAudioDevices();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ import java.util.concurrent.Executor;
|
|||||||
|
|
||||||
public class CircularIconsPreference extends RestrictedPreference {
|
public class CircularIconsPreference extends RestrictedPreference {
|
||||||
|
|
||||||
|
private static final float DISABLED_ITEM_ALPHA = 0.3f;
|
||||||
|
|
||||||
private Executor mUiExecutor;
|
private Executor mUiExecutor;
|
||||||
@Nullable private LinearLayout mIconContainer;
|
@Nullable private LinearLayout mIconContainer;
|
||||||
|
|
||||||
@@ -98,6 +100,14 @@ public class CircularIconsPreference extends RestrictedPreference {
|
|||||||
displayIconsIfPending();
|
displayIconsIfPending();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setEnabled(boolean enabled) {
|
||||||
|
super.setEnabled(enabled);
|
||||||
|
if (mIconContainer != null) {
|
||||||
|
applyEnabledToIcons(mIconContainer, enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void displayIconsIfPending() {
|
private void displayIconsIfPending() {
|
||||||
CircularIconSet<?> pendingIconSet = mPendingDisplayIconSet;
|
CircularIconSet<?> pendingIconSet = mPendingDisplayIconSet;
|
||||||
if (pendingIconSet != null) {
|
if (pendingIconSet != null) {
|
||||||
@@ -211,6 +221,8 @@ public class CircularIconsPreference extends RestrictedPreference {
|
|||||||
textView.setText(getContext().getString(R.string.zen_mode_plus_n_items, extraItems));
|
textView.setText(getContext().getString(R.string.zen_mode_plus_n_items, extraItems));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applyEnabledToIcons(mIconContainer, isEnabled());
|
||||||
|
|
||||||
// Display icons when all are ready (more consistent than randomly loading).
|
// Display icons when all are ready (more consistent than randomly loading).
|
||||||
mPendingLoadIconsFuture = Futures.allAsList(iconFutures);
|
mPendingLoadIconsFuture = Futures.allAsList(iconFutures);
|
||||||
FutureUtil.whenDone(
|
FutureUtil.whenDone(
|
||||||
@@ -224,6 +236,13 @@ public class CircularIconsPreference extends RestrictedPreference {
|
|||||||
mUiExecutor);
|
mUiExecutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applyEnabledToIcons(ViewGroup container, boolean enabled) {
|
||||||
|
for (int i = 0; i < container.getChildCount(); i++) {
|
||||||
|
View child = container.getChildAt(i);
|
||||||
|
child.setAlpha(enabled ? 1.0f : DISABLED_ITEM_ALPHA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static Drawable getPlaceholderImage(Context context) {
|
private static Drawable getPlaceholderImage(Context context) {
|
||||||
ShapeDrawable placeholder = new ShapeDrawable(new OvalShape());
|
ShapeDrawable placeholder = new ShapeDrawable(new OvalShape());
|
||||||
placeholder.setTintList(Utils.getColorAttr(context,
|
placeholder.setTintList(Utils.getColorAttr(context,
|
||||||
@@ -249,6 +268,18 @@ public class CircularIconsPreference extends RestrictedPreference {
|
|||||||
return parent.getChildAt(parent.getChildCount() - 1);
|
return parent.getChildAt(parent.getChildCount() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
|
||||||
|
List<View> getViews() {
|
||||||
|
if (mIconContainer == null) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
ArrayList<View> views = new ArrayList<>();
|
||||||
|
for (int i = 0; i < mIconContainer.getChildCount(); i++) {
|
||||||
|
views.add(mIconContainer.getChildAt(i));
|
||||||
|
}
|
||||||
|
return views;
|
||||||
|
}
|
||||||
|
|
||||||
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
|
@VisibleForTesting(otherwise = VisibleForTesting.NONE)
|
||||||
List<Drawable> getIcons() {
|
List<Drawable> getIcons() {
|
||||||
if (mIconContainer == null) {
|
if (mIconContainer == null) {
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ class InterruptionFilterPreferenceController extends AbstractZenModePreferenceCo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
public void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
||||||
|
preference.setEnabled(zenMode.isEnabled());
|
||||||
boolean filteringNotifications = zenMode.getRule().getInterruptionFilter()
|
boolean filteringNotifications = zenMode.getRule().getInterruptionFilter()
|
||||||
!= INTERRUPTION_FILTER_ALL;
|
!= INTERRUPTION_FILTER_ALL;
|
||||||
((TwoStatePreference) preference).setChecked(filteringNotifications);
|
((TwoStatePreference) preference).setChecked(filteringNotifications);
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import androidx.preference.Preference;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.Utils;
|
import com.android.settings.Utils;
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
|
||||||
import com.android.settingslib.applications.ApplicationsState;
|
import com.android.settingslib.applications.ApplicationsState;
|
||||||
import com.android.settingslib.applications.ApplicationsState.AppEntry;
|
import com.android.settingslib.applications.ApplicationsState.AppEntry;
|
||||||
import com.android.settingslib.notification.modes.ZenMode;
|
import com.android.settingslib.notification.modes.ZenMode;
|
||||||
@@ -95,11 +94,11 @@ class ZenModeAppsLinkPreferenceController extends AbstractZenModePreferenceContr
|
|||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
||||||
// TODO(b/332937635): Update metrics category
|
// TODO(b/332937635): Update metrics category
|
||||||
preference.setIntent(new SubSettingLauncher(mContext)
|
preference.setIntent(
|
||||||
.setDestination(ZenModeAppsFragment.class.getName())
|
ZenSubSettingLauncher.forModeFragment(mContext, ZenModeAppsFragment.class,
|
||||||
.setSourceMetricsCategory(0)
|
zenMode.getId(), 0).toIntent());
|
||||||
.setArguments(bundle)
|
preference.setEnabled(zenMode.isEnabled());
|
||||||
.toIntent());
|
|
||||||
mZenMode = zenMode;
|
mZenMode = zenMode;
|
||||||
mPreference = (CircularIconsPreference) preference;
|
mPreference = (CircularIconsPreference) preference;
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import android.os.Bundle;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
|
||||||
import com.android.settingslib.notification.modes.ZenMode;
|
import com.android.settingslib.notification.modes.ZenMode;
|
||||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||||
|
|
||||||
@@ -43,11 +42,10 @@ class ZenModeDisplayLinkPreferenceController extends AbstractZenModePreferenceCo
|
|||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
bundle.putString(EXTRA_AUTOMATIC_ZEN_RULE_ID, zenMode.getId());
|
||||||
// TODO(b/332937635): Update metrics category
|
// TODO(b/332937635): Update metrics category
|
||||||
preference.setIntent(new SubSettingLauncher(mContext)
|
preference.setIntent(
|
||||||
.setDestination(ZenModeDisplayFragment.class.getName())
|
ZenSubSettingLauncher.forModeFragment(mContext, ZenModeDisplayFragment.class,
|
||||||
.setSourceMetricsCategory(0)
|
zenMode.getId(), 0).toIntent());
|
||||||
.setArguments(bundle)
|
preference.setEnabled(zenMode.isEnabled());
|
||||||
.toIntent());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -53,12 +53,15 @@ public class ZenModeFragment extends ZenModeFragmentBase {
|
|||||||
prefControllers.add(new ZenModeHeaderController(context, "header", this));
|
prefControllers.add(new ZenModeHeaderController(context, "header", this));
|
||||||
prefControllers.add(
|
prefControllers.add(
|
||||||
new ZenModeButtonPreferenceController(context, "activate", this, mBackend));
|
new ZenModeButtonPreferenceController(context, "activate", this, mBackend));
|
||||||
|
prefControllers.add(new ZenModePreferenceCategoryController(context, "modes_filters"));
|
||||||
prefControllers.add(new ZenModePeopleLinkPreferenceController(
|
prefControllers.add(new ZenModePeopleLinkPreferenceController(
|
||||||
context, "zen_mode_people", mHelperBackend));
|
context, "zen_mode_people", mHelperBackend));
|
||||||
prefControllers.add(new ZenModeAppsLinkPreferenceController(
|
prefControllers.add(new ZenModeAppsLinkPreferenceController(
|
||||||
context, "zen_mode_apps", this, mBackend, mHelperBackend));
|
context, "zen_mode_apps", this, mBackend, mHelperBackend));
|
||||||
prefControllers.add(new ZenModeOtherLinkPreferenceController(
|
prefControllers.add(new ZenModeOtherLinkPreferenceController(
|
||||||
context, "zen_other_settings", mHelperBackend));
|
context, "zen_other_settings", mHelperBackend));
|
||||||
|
prefControllers.add(
|
||||||
|
new ZenModePreferenceCategoryController(context, "modes_additional_actions"));
|
||||||
prefControllers.add(new ZenModeDisplayLinkPreferenceController(
|
prefControllers.add(new ZenModeDisplayLinkPreferenceController(
|
||||||
context, "mode_display_settings", mBackend, mHelperBackend));
|
context, "mode_display_settings", mBackend, mHelperBackend));
|
||||||
prefControllers.add(new ZenModeSetTriggerLinkPreferenceController(context,
|
prefControllers.add(new ZenModeSetTriggerLinkPreferenceController(context,
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ class ZenModeOtherLinkPreferenceController extends AbstractZenModePreferenceCont
|
|||||||
ZenSubSettingLauncher.forModeFragment(mContext, ZenModeOtherFragment.class,
|
ZenSubSettingLauncher.forModeFragment(mContext, ZenModeOtherFragment.class,
|
||||||
zenMode.getId(), 0).toIntent());
|
zenMode.getId(), 0).toIntent());
|
||||||
|
|
||||||
|
preference.setEnabled(zenMode.isEnabled());
|
||||||
preference.setSummary(mSummaryHelper.getOtherSoundCategoriesSummary(zenMode));
|
preference.setSummary(mSummaryHelper.getOtherSoundCategoriesSummary(zenMode));
|
||||||
((CircularIconsPreference) preference).displayIcons(getSoundIcons(zenMode.getPolicy()));
|
((CircularIconsPreference) preference).displayIcons(getSoundIcons(zenMode.getPolicy()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ class ZenModePeopleLinkPreferenceController extends AbstractZenModePreferenceCon
|
|||||||
ZenSubSettingLauncher.forModeFragment(mContext, ZenModePeopleFragment.class,
|
ZenSubSettingLauncher.forModeFragment(mContext, ZenModePeopleFragment.class,
|
||||||
zenMode.getId(), 0).toIntent());
|
zenMode.getId(), 0).toIntent());
|
||||||
|
|
||||||
|
preference.setEnabled(zenMode.isEnabled());
|
||||||
preference.setSummary(mSummaryHelper.getPeopleSummary(zenMode.getPolicy()));
|
preference.setSummary(mSummaryHelper.getPeopleSummary(zenMode.getPolicy()));
|
||||||
((CircularIconsPreference) preference).displayIcons(getPeopleIcons(zenMode.getPolicy()));
|
((CircularIconsPreference) preference).displayIcons(getPeopleIcons(zenMode.getPolicy()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.settings.notification.modes;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
|
import com.android.settingslib.notification.modes.ZenMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple {@link AbstractZenModePreferenceController} used for all {@code PreferenceCategory}
|
||||||
|
* entries in {@link ZenModeFragment} that should be disabled when the mode is disabled.
|
||||||
|
*/
|
||||||
|
class ZenModePreferenceCategoryController extends AbstractZenModePreferenceController {
|
||||||
|
ZenModePreferenceCategoryController(@NonNull Context context, @NonNull String key) {
|
||||||
|
super(context, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void updateState(Preference preference, @NonNull ZenMode zenMode) {
|
||||||
|
preference.setEnabled(zenMode.isEnabled());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,4 +39,12 @@ interface OnboardingFeatureProvider {
|
|||||||
* @param logger To log B&R stats.
|
* @param logger To log B&R stats.
|
||||||
*/
|
*/
|
||||||
fun getSoundBackupHelper(context: Context, logger: BackupRestoreEventLogger): BackupHelper
|
fun getSoundBackupHelper(context: Context, logger: BackupRestoreEventLogger): BackupHelper
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a BackupHelper for backup accessibility appearance related settings.
|
||||||
|
*
|
||||||
|
* @param context App context
|
||||||
|
* @param logger To log B&R stats.
|
||||||
|
*/
|
||||||
|
fun getAccessibilityAppearanceBackupHelper(context: Context, logger: BackupRestoreEventLogger): BackupHelper
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
package com.android.settings.widget;
|
package com.android.settings.widget;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -212,6 +213,14 @@ public class HighlightableTopLevelPreferenceAdapter extends RoundCornerPreferenc
|
|||||||
// Scroll to the top to reset the position.
|
// Scroll to the top to reset the position.
|
||||||
mRecyclerView.nestedScrollBy(0, -mRecyclerView.getHeight());
|
mRecyclerView.nestedScrollBy(0, -mRecyclerView.getHeight());
|
||||||
|
|
||||||
|
// get the visible area of the recycler view
|
||||||
|
Rect rvRect = new Rect();
|
||||||
|
mRecyclerView.getGlobalVisibleRect(rvRect);
|
||||||
|
if (Flags.homepageRevamp() && view.getBottom() <= rvRect.height()) {
|
||||||
|
// the request position already fully visible in the visible area
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final int scrollY = view.getTop();
|
final int scrollY = view.getTop();
|
||||||
if (scrollY > 0) {
|
if (scrollY > 0) {
|
||||||
mRecyclerView.nestedScrollBy(0, scrollY);
|
mRecyclerView.nestedScrollBy(0, scrollY);
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ public class WifiConfigController2 implements TextWatcher,
|
|||||||
|
|
||||||
if (mPrivacySettingsSpinner != null) {
|
if (mPrivacySettingsSpinner != null) {
|
||||||
final int prefMacValue = WifiPrivacyPreferenceController2
|
final int prefMacValue = WifiPrivacyPreferenceController2
|
||||||
.translateMacRandomizedValueToPrefValue(config.macRandomizationSetting);
|
.translateWifiEntryPrivacyToPrefValue(mWifiEntry.getPrivacy());
|
||||||
mPrivacySettingsSpinner.setSelection(prefMacValue);
|
mPrivacySettingsSpinner.setSelection(prefMacValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -863,7 +863,7 @@ public class WifiConfigController2 implements TextWatcher,
|
|||||||
|
|
||||||
if (mPrivacySettingsSpinner != null) {
|
if (mPrivacySettingsSpinner != null) {
|
||||||
config.macRandomizationSetting = WifiPrivacyPreferenceController2
|
config.macRandomizationSetting = WifiPrivacyPreferenceController2
|
||||||
.translatePrefValueToMacRandomizedValue(mPrivacySettingsSpinner
|
.translatePrefValueToWifiConfigSetting(mPrivacySettingsSpinner
|
||||||
.getSelectedItemPosition());
|
.getSelectedItemPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package com.android.settings.wifi.details2;
|
package com.android.settings.wifi.details2;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.net.wifi.WifiConfiguration;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -98,30 +99,30 @@ public class WifiPrivacyPreferenceController2 extends BasePreferenceController i
|
|||||||
private static final int PREF_RANDOMIZATION_NONE = 1;
|
private static final int PREF_RANDOMIZATION_NONE = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns preference index value.
|
* Translates a WifiEntry.Privacy value to the matching preference index value.
|
||||||
*
|
*
|
||||||
* @param macRandomized is mac randomized value
|
* @param privacy WifiEntry.Privacy value
|
||||||
* @return index value of preference
|
* @return index value of preference
|
||||||
*/
|
*/
|
||||||
public static int translateMacRandomizedValueToPrefValue(int macRandomized) {
|
public static int translateWifiEntryPrivacyToPrefValue(@WifiEntry.Privacy int privacy) {
|
||||||
return (macRandomized == WifiEntry.PRIVACY_RANDOMIZED_MAC)
|
return (privacy == WifiEntry.PRIVACY_RANDOMIZED_MAC)
|
||||||
? PREF_RANDOMIZATION_PERSISTENT : PREF_RANDOMIZATION_NONE;
|
? PREF_RANDOMIZATION_PERSISTENT : PREF_RANDOMIZATION_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns mac randomized value.
|
* Translates the pref value to WifiConfiguration.MacRandomizationSetting value
|
||||||
*
|
*
|
||||||
* @param prefMacRandomized is preference index value
|
* @param prefMacRandomized is preference index value
|
||||||
* @return mac randomized value
|
* @return WifiConfiguration.MacRandomizationSetting value
|
||||||
*/
|
*/
|
||||||
public static int translatePrefValueToMacRandomizedValue(int prefMacRandomized) {
|
public static int translatePrefValueToWifiConfigSetting(int prefMacRandomized) {
|
||||||
return (prefMacRandomized == PREF_RANDOMIZATION_PERSISTENT)
|
return (prefMacRandomized == PREF_RANDOMIZATION_PERSISTENT)
|
||||||
? WifiEntry.PRIVACY_RANDOMIZED_MAC : WifiEntry.PRIVACY_DEVICE_MAC;
|
? WifiConfiguration.RANDOMIZATION_AUTO : WifiConfiguration.RANDOMIZATION_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSummary(ListPreference preference, int macRandomized) {
|
private void updateSummary(ListPreference preference, int macRandomized) {
|
||||||
// Translates value here to set RANDOMIZATION_PERSISTENT as first item in UI for better UX.
|
// Translates value here to set RANDOMIZATION_PERSISTENT as first item in UI for better UX.
|
||||||
final int prefMacRandomized = translateMacRandomizedValueToPrefValue(macRandomized);
|
final int prefMacRandomized = translateWifiEntryPrivacyToPrefValue(macRandomized);
|
||||||
preference.setSummary(preference.getEntries()[prefMacRandomized]);
|
preference.setSummary(preference.getEntries()[prefMacRandomized]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ public class WifiDppQrCodeGeneratorFragment extends WifiDppQrCodeBaseFragment {
|
|||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
mQrCodeView = view.findViewById(R.id.qrcode_view);
|
mQrCodeView = view.findViewById(R.id.qrcode_view);
|
||||||
|
mQrCodeView.setContentDescription(getString(R.string.qr_code_content_description));
|
||||||
|
|
||||||
final WifiNetworkConfig wifiNetworkConfig = getWifiNetworkConfigFromHostActivity();
|
final WifiNetworkConfig wifiNetworkConfig = getWifiNetworkConfigFromHostActivity();
|
||||||
if (wifiNetworkConfig.isHotspot()) {
|
if (wifiNetworkConfig.isHotspot()) {
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ public class MainClearConfirmTest {
|
|||||||
|
|
||||||
when(mMockActivity.getSystemService(Context.DEVICE_POLICY_SERVICE))
|
when(mMockActivity.getSystemService(Context.DEVICE_POLICY_SERVICE))
|
||||||
.thenReturn(mDevicePolicyManager);
|
.thenReturn(mDevicePolicyManager);
|
||||||
|
when(mPersistentDataBlockManager.isFactoryResetProtectionActive()).thenReturn(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -112,6 +113,13 @@ public class MainClearConfirmTest {
|
|||||||
assertThat(mMainClearConfirm.shouldWipePersistentDataBlock(null)).isFalse();
|
assertThat(mMainClearConfirm.shouldWipePersistentDataBlock(null)).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void shouldWipePersistentDataBlock_frpIsAlive_shouldReturnFalse() {
|
||||||
|
when(mPersistentDataBlockManager.isFactoryResetProtectionActive()).thenReturn(true);
|
||||||
|
assertThat(mMainClearConfirm.shouldWipePersistentDataBlock(mPersistentDataBlockManager))
|
||||||
|
.isFalse();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldWipePersistentDataBlock_deviceIsStillBeingProvisioned_shouldReturnFalse() {
|
public void shouldWipePersistentDataBlock_deviceIsStillBeingProvisioned_shouldReturnFalse() {
|
||||||
doReturn(true).when(mMainClearConfirm).isDeviceStillBeingProvisioned();
|
doReturn(true).when(mMainClearConfirm).isDeviceStillBeingProvisioned();
|
||||||
|
|||||||
@@ -226,4 +226,32 @@ public class CircularIconsPreferenceTest {
|
|||||||
mPreference.displayIcons(one);
|
mPreference.displayIcons(one);
|
||||||
mPreference.displayIcons(same); // if no exception, wasn't called.
|
mPreference.displayIcons(same); // if no exception, wasn't called.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void setEnabled_afterDisplayIcons_showsEnabledOrDisabledImages() {
|
||||||
|
CircularIconSet<Integer> iconSet = new CircularIconSet<>(ImmutableList.of(1, 2),
|
||||||
|
ColorDrawable::new);
|
||||||
|
bindAndMeasureViewHolder(VIEW_WIDTH);
|
||||||
|
mPreference.displayIcons(iconSet);
|
||||||
|
assertThat(mPreference.getViews()).hasSize(2);
|
||||||
|
|
||||||
|
mPreference.setEnabled(false);
|
||||||
|
assertThat(mPreference.getViews().get(0).getAlpha()).isLessThan(1f);
|
||||||
|
|
||||||
|
mPreference.setEnabled(true);
|
||||||
|
assertThat(mPreference.getViews().get(0).getAlpha()).isEqualTo(1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void setEnabled_beforeDisplayIcons_showsEnabledOrDisabledImages() {
|
||||||
|
CircularIconSet<Integer> iconSet = new CircularIconSet<>(ImmutableList.of(1, 2),
|
||||||
|
ColorDrawable::new);
|
||||||
|
|
||||||
|
mPreference.setEnabled(false);
|
||||||
|
bindAndMeasureViewHolder(VIEW_WIDTH);
|
||||||
|
mPreference.displayIcons(iconSet);
|
||||||
|
|
||||||
|
assertThat(mPreference.getViews()).hasSize(2);
|
||||||
|
assertThat(mPreference.getViews().get(0).getAlpha()).isLessThan(1f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,18 @@ public final class InterruptionFilterPreferenceControllerTest {
|
|||||||
mController = new InterruptionFilterPreferenceController(mContext, "something", mBackend);
|
mController = new InterruptionFilterPreferenceController(mContext, "something", mBackend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateState_disabled() {
|
||||||
|
TwoStatePreference preference = mock(TwoStatePreference.class);
|
||||||
|
ZenMode zenMode = new TestModeBuilder()
|
||||||
|
.setEnabled(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
mController.updateZenMode(preference, zenMode);
|
||||||
|
|
||||||
|
verify(preference).setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateState_all() {
|
public void testUpdateState_all() {
|
||||||
TwoStatePreference preference = mock(TwoStatePreference.class);
|
TwoStatePreference preference = mock(TwoStatePreference.class);
|
||||||
|
|||||||
@@ -141,6 +141,17 @@ public final class ZenModeAppsLinkPreferenceControllerTest {
|
|||||||
assertThat(mController.isAvailable()).isTrue();
|
assertThat(mController.isAvailable()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateState_disabled() {
|
||||||
|
ZenMode zenMode = new TestModeBuilder()
|
||||||
|
.setEnabled(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
mController.updateState(mPreference, zenMode);
|
||||||
|
|
||||||
|
assertThat(mPreference.isEnabled()).isFalse();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateSetsIntent() {
|
public void testUpdateSetsIntent() {
|
||||||
// Create a zen mode that allows priority channels to breakthrough.
|
// Create a zen mode that allows priority channels to breakthrough.
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import android.platform.test.flag.junit.SetFlagsRule;
|
|||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
import com.android.settingslib.notification.modes.TestModeBuilder;
|
import com.android.settingslib.notification.modes.TestModeBuilder;
|
||||||
|
import com.android.settingslib.notification.modes.ZenMode;
|
||||||
import com.android.settingslib.notification.modes.ZenModesBackend;
|
import com.android.settingslib.notification.modes.ZenModesBackend;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -61,6 +62,18 @@ public final class ZenModeDisplayLinkPreferenceControllerTest {
|
|||||||
mContext, "something", mBackend, mHelperBackend);
|
mContext, "something", mBackend, mHelperBackend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpdateState_disabled() {
|
||||||
|
Preference preference = mock(Preference.class);
|
||||||
|
ZenMode zenMode = new TestModeBuilder()
|
||||||
|
.setEnabled(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
mController.updateState(preference, zenMode);
|
||||||
|
|
||||||
|
verify(preference).setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@EnableFlags(Flags.FLAG_MODES_UI)
|
@EnableFlags(Flags.FLAG_MODES_UI)
|
||||||
public void testHasSummary() {
|
public void testHasSummary() {
|
||||||
|
|||||||
@@ -61,6 +61,18 @@ public final class ZenModeOtherLinkPreferenceControllerTest {
|
|||||||
mContext, "something", mHelperBackend);
|
mContext, "something", mHelperBackend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void updateState_disabled() {
|
||||||
|
CircularIconsPreference pref = mock(CircularIconsPreference.class);
|
||||||
|
ZenMode zenMode = new TestModeBuilder()
|
||||||
|
.setEnabled(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
mController.updateZenMode(pref, zenMode);
|
||||||
|
|
||||||
|
verify(pref).setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateState_loadsSummary() {
|
public void updateState_loadsSummary() {
|
||||||
CircularIconsPreference pref = mock(CircularIconsPreference.class);
|
CircularIconsPreference pref = mock(CircularIconsPreference.class);
|
||||||
|
|||||||
@@ -111,6 +111,17 @@ public final class ZenModePeopleLinkPreferenceControllerTest {
|
|||||||
anyBoolean())).thenReturn(new ColorDrawable(Color.BLACK));
|
anyBoolean())).thenReturn(new ColorDrawable(Color.BLACK));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void updateState_disabled() {
|
||||||
|
ZenMode zenMode = new TestModeBuilder()
|
||||||
|
.setEnabled(false)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
mController.updateState(mPreference, zenMode);
|
||||||
|
|
||||||
|
assertThat(mPreference.isEnabled()).isFalse();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateState_setsSummary() {
|
public void updateState_setsSummary() {
|
||||||
mController.updateState(mPreference, TestModeBuilder.EXAMPLE);
|
mController.updateState(mPreference, TestModeBuilder.EXAMPLE);
|
||||||
|
|||||||
@@ -459,46 +459,45 @@ public class WifiConfigController2Test {
|
|||||||
public void loadMacRandomizedValue_shouldPersistentAsDefault() {
|
public void loadMacRandomizedValue_shouldPersistentAsDefault() {
|
||||||
final Spinner privacySetting = mView.findViewById(R.id.privacy_settings);
|
final Spinner privacySetting = mView.findViewById(R.id.privacy_settings);
|
||||||
final int prefPersist =
|
final int prefPersist =
|
||||||
WifiPrivacyPreferenceController2.translateMacRandomizedValueToPrefValue(
|
WifiPrivacyPreferenceController2.translateWifiEntryPrivacyToPrefValue(
|
||||||
WifiConfiguration.RANDOMIZATION_PERSISTENT);
|
WifiEntry.PRIVACY_RANDOMIZED_MAC);
|
||||||
|
|
||||||
assertThat(privacySetting.getVisibility()).isEqualTo(View.VISIBLE);
|
assertThat(privacySetting.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
assertThat(privacySetting.getSelectedItemPosition()).isEqualTo(prefPersist);
|
assertThat(privacySetting.getSelectedItemPosition()).isEqualTo(prefPersist);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void loadSavedMacRandomizedPersistentValue_shouldCorrectMacValue() {
|
public void loadSavedPrivacyRandomizedMacValue_shouldCorrectMacValue() {
|
||||||
checkSavedMacRandomizedValue(WifiConfiguration.RANDOMIZATION_PERSISTENT);
|
checkSavedMacRandomizedValue(WifiEntry.PRIVACY_RANDOMIZED_MAC);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void loadSavedMacRandomizedNoneValue_shouldCorrectMacValue() {
|
public void loadSavedPrivacyDeviceMacValue_shouldCorrectMacValue() {
|
||||||
checkSavedMacRandomizedValue(WifiConfiguration.RANDOMIZATION_NONE);
|
checkSavedMacRandomizedValue(WifiEntry.PRIVACY_DEVICE_MAC);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkSavedMacRandomizedValue(int macRandomizedValue) {
|
private void checkSavedMacRandomizedValue(@WifiEntry.Privacy int privacy) {
|
||||||
when(mWifiEntry.isSaved()).thenReturn(true);
|
when(mWifiEntry.isSaved()).thenReturn(true);
|
||||||
final WifiConfiguration mockWifiConfig = spy(new WifiConfiguration());
|
final WifiConfiguration mockWifiConfig = spy(new WifiConfiguration());
|
||||||
when(mockWifiConfig.getIpConfiguration()).thenReturn(mock(IpConfiguration.class));
|
when(mockWifiConfig.getIpConfiguration()).thenReturn(mock(IpConfiguration.class));
|
||||||
when(mWifiEntry.getWifiConfiguration()).thenReturn(mockWifiConfig);
|
when(mWifiEntry.getWifiConfiguration()).thenReturn(mockWifiConfig);
|
||||||
mockWifiConfig.macRandomizationSetting = macRandomizedValue;
|
when(mWifiEntry.getPrivacy()).thenReturn(privacy);
|
||||||
createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false);
|
createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false);
|
||||||
|
|
||||||
final Spinner privacySetting = mView.findViewById(R.id.privacy_settings);
|
final Spinner privacySetting = mView.findViewById(R.id.privacy_settings);
|
||||||
final int expectedPrefValue =
|
final int expectedPrefValue =
|
||||||
WifiPrivacyPreferenceController2.translateMacRandomizedValueToPrefValue(
|
WifiPrivacyPreferenceController2.translateWifiEntryPrivacyToPrefValue(privacy);
|
||||||
macRandomizedValue);
|
|
||||||
|
|
||||||
assertThat(privacySetting.getVisibility()).isEqualTo(View.VISIBLE);
|
assertThat(privacySetting.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
assertThat(privacySetting.getSelectedItemPosition()).isEqualTo(expectedPrefValue);
|
assertThat(privacySetting.getSelectedItemPosition()).isEqualTo(expectedPrefValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void saveMacRandomizedValue_noChanged_shouldPersistentAsDefault() {
|
public void saveMacRandomizedValue_noChanged_shouldAutoAsDefault() {
|
||||||
createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false);
|
createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false);
|
||||||
WifiConfiguration config = mController.getConfig();
|
WifiConfiguration config = mController.getConfig();
|
||||||
assertThat(config.macRandomizationSetting).isEqualTo(
|
assertThat(config.macRandomizationSetting).isEqualTo(
|
||||||
WifiConfiguration.RANDOMIZATION_PERSISTENT);
|
WifiConfiguration.RANDOMIZATION_AUTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -506,7 +505,7 @@ public class WifiConfigController2Test {
|
|||||||
createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false);
|
createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false);
|
||||||
final Spinner privacySetting = mView.findViewById(R.id.privacy_settings);
|
final Spinner privacySetting = mView.findViewById(R.id.privacy_settings);
|
||||||
final int prefMacNone =
|
final int prefMacNone =
|
||||||
WifiPrivacyPreferenceController2.translateMacRandomizedValueToPrefValue(
|
WifiPrivacyPreferenceController2.translateWifiEntryPrivacyToPrefValue(
|
||||||
WifiConfiguration.RANDOMIZATION_NONE);
|
WifiConfiguration.RANDOMIZATION_NONE);
|
||||||
privacySetting.setSelection(prefMacNone);
|
privacySetting.setSelection(prefMacNone);
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class WifiPrivacyPreferenceController2Test {
|
|||||||
|
|
||||||
controller.updateState(preference)
|
controller.updateState(preference)
|
||||||
|
|
||||||
val prefValue = WifiPrivacyPreferenceController2.translateMacRandomizedValueToPrefValue(
|
val prefValue = WifiPrivacyPreferenceController2.translateWifiEntryPrivacyToPrefValue(
|
||||||
WifiEntry.PRIVACY_DEVICE_MAC
|
WifiEntry.PRIVACY_DEVICE_MAC
|
||||||
)
|
)
|
||||||
assertThat(preference.entry).isEqualTo(preferenceStrings[prefValue])
|
assertThat(preference.entry).isEqualTo(preferenceStrings[prefValue])
|
||||||
@@ -73,7 +73,7 @@ class WifiPrivacyPreferenceController2Test {
|
|||||||
|
|
||||||
controller.updateState(preference)
|
controller.updateState(preference)
|
||||||
|
|
||||||
val prefValue = WifiPrivacyPreferenceController2.translateMacRandomizedValueToPrefValue(
|
val prefValue = WifiPrivacyPreferenceController2.translateWifiEntryPrivacyToPrefValue(
|
||||||
WifiEntry.PRIVACY_RANDOMIZED_MAC
|
WifiEntry.PRIVACY_RANDOMIZED_MAC
|
||||||
)
|
)
|
||||||
assertThat(preference.entry).isEqualTo(preferenceStrings[prefValue])
|
assertThat(preference.entry).isEqualTo(preferenceStrings[prefValue])
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ public class ExternalDisplayTestBase {
|
|||||||
doReturn(mHandler).when(mMockedInjector).getHandler();
|
doReturn(mHandler).when(mMockedInjector).getHandler();
|
||||||
doReturn("").when(mMockedInjector).getSystemProperty(
|
doReturn("").when(mMockedInjector).getSystemProperty(
|
||||||
VIRTUAL_DISPLAY_PACKAGE_NAME_SYSTEM_PROPERTY);
|
VIRTUAL_DISPLAY_PACKAGE_NAME_SYSTEM_PROPERTY);
|
||||||
|
doReturn(true).when(mMockedInjector).isModeLimitForExternalDisplayEnabled();
|
||||||
doAnswer((arg) -> {
|
doAnswer((arg) -> {
|
||||||
mListener = arg.getArgument(0);
|
mListener = arg.getArgument(0);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ package com.android.settings.connecteddevice.display;
|
|||||||
|
|
||||||
import static android.view.Display.INVALID_DISPLAY;
|
import static android.view.Display.INVALID_DISPLAY;
|
||||||
|
|
||||||
|
import static com.android.settings.connecteddevice.display.ResolutionPreferenceFragment.DISPLAY_MODE_LIMIT_OVERRIDE_PROP;
|
||||||
import static com.android.settings.connecteddevice.display.ResolutionPreferenceFragment.EXTERNAL_DISPLAY_RESOLUTION_SETTINGS_RESOURCE;
|
import static com.android.settings.connecteddevice.display.ResolutionPreferenceFragment.EXTERNAL_DISPLAY_RESOLUTION_SETTINGS_RESOURCE;
|
||||||
import static com.android.settings.connecteddevice.display.ResolutionPreferenceFragment.MORE_OPTIONS_KEY;
|
import static com.android.settings.connecteddevice.display.ResolutionPreferenceFragment.MORE_OPTIONS_KEY;
|
||||||
import static com.android.settings.connecteddevice.display.ResolutionPreferenceFragment.TOP_OPTIONS_KEY;
|
import static com.android.settings.connecteddevice.display.ResolutionPreferenceFragment.TOP_OPTIONS_KEY;
|
||||||
@@ -29,6 +30,7 @@ import static org.mockito.Mockito.verify;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.util.Pair;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@@ -83,18 +85,52 @@ public class ResolutionPreferenceFragmentTest extends ExternalDisplayTestBase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UiThreadTest
|
@UiThreadTest
|
||||||
public void testModePreferences() {
|
public void testModePreferences_modeLimitFlagIsOn_noOverride() {
|
||||||
mDisplayIdArg = 1;
|
doReturn(true).when(mMockedInjector).isModeLimitForExternalDisplayEnabled();
|
||||||
initFragment();
|
doReturn(null).when(mMockedInjector).getSystemProperty(
|
||||||
mHandler.flush();
|
DISPLAY_MODE_LIMIT_OVERRIDE_PROP);
|
||||||
PreferenceCategory topPref = mPreferenceScreen.findPreference(TOP_OPTIONS_KEY);
|
var topAndMorePref = runTestModePreferences();
|
||||||
assertThat(topPref).isNotNull();
|
PreferenceCategory topPref = topAndMorePref.first, morePref = topAndMorePref.second;
|
||||||
PreferenceCategory morePref = mPreferenceScreen.findPreference(MORE_OPTIONS_KEY);
|
|
||||||
assertThat(morePref).isNotNull();
|
|
||||||
assertThat(topPref.getPreferenceCount()).isEqualTo(3);
|
assertThat(topPref.getPreferenceCount()).isEqualTo(3);
|
||||||
assertThat(morePref.getPreferenceCount()).isEqualTo(1);
|
assertThat(morePref.getPreferenceCount()).isEqualTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@UiThreadTest
|
||||||
|
public void testModePreferences_noModeLimitFlag_overrideIsTrue() {
|
||||||
|
doReturn(false).when(mMockedInjector).isModeLimitForExternalDisplayEnabled();
|
||||||
|
doReturn("true").when(mMockedInjector).getSystemProperty(
|
||||||
|
DISPLAY_MODE_LIMIT_OVERRIDE_PROP);
|
||||||
|
var topAndMorePref = runTestModePreferences();
|
||||||
|
PreferenceCategory topPref = topAndMorePref.first, morePref = topAndMorePref.second;
|
||||||
|
assertThat(topPref.getPreferenceCount()).isEqualTo(3);
|
||||||
|
assertThat(morePref.getPreferenceCount()).isEqualTo(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@UiThreadTest
|
||||||
|
public void testModePreferences_noModeLimitFlag_noOverride() {
|
||||||
|
doReturn(false).when(mMockedInjector).isModeLimitForExternalDisplayEnabled();
|
||||||
|
doReturn(null).when(mMockedInjector).getSystemProperty(
|
||||||
|
DISPLAY_MODE_LIMIT_OVERRIDE_PROP);
|
||||||
|
var topAndMorePref = runTestModePreferences();
|
||||||
|
PreferenceCategory topPref = topAndMorePref.first, morePref = topAndMorePref.second;
|
||||||
|
assertThat(topPref.getPreferenceCount()).isEqualTo(3);
|
||||||
|
assertThat(morePref.getPreferenceCount()).isEqualTo(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@UiThreadTest
|
||||||
|
public void testModePreferences_modeLimitFlagIsOn_butOverrideIsFalse() {
|
||||||
|
doReturn(true).when(mMockedInjector).isModeLimitForExternalDisplayEnabled();
|
||||||
|
doReturn("false").when(mMockedInjector).getSystemProperty(
|
||||||
|
DISPLAY_MODE_LIMIT_OVERRIDE_PROP);
|
||||||
|
var topAndMorePref = runTestModePreferences();
|
||||||
|
PreferenceCategory topPref = topAndMorePref.first, morePref = topAndMorePref.second;
|
||||||
|
assertThat(topPref.getPreferenceCount()).isEqualTo(3);
|
||||||
|
assertThat(morePref.getPreferenceCount()).isEqualTo(2);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UiThreadTest
|
@UiThreadTest
|
||||||
public void testModeChange() {
|
public void testModeChange() {
|
||||||
@@ -109,6 +145,17 @@ public class ResolutionPreferenceFragmentTest extends ExternalDisplayTestBase {
|
|||||||
verify(mMockedInjector).setUserPreferredDisplayMode(mDisplayIdArg, mode);
|
verify(mMockedInjector).setUserPreferredDisplayMode(mDisplayIdArg, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Pair<PreferenceCategory, PreferenceCategory> runTestModePreferences() {
|
||||||
|
mDisplayIdArg = 1;
|
||||||
|
initFragment();
|
||||||
|
mHandler.flush();
|
||||||
|
PreferenceCategory topPref = mPreferenceScreen.findPreference(TOP_OPTIONS_KEY);
|
||||||
|
assertThat(topPref).isNotNull();
|
||||||
|
PreferenceCategory morePref = mPreferenceScreen.findPreference(MORE_OPTIONS_KEY);
|
||||||
|
assertThat(morePref).isNotNull();
|
||||||
|
return new Pair<>(topPref, morePref);
|
||||||
|
}
|
||||||
|
|
||||||
private void initFragment() {
|
private void initFragment() {
|
||||||
if (mFragment != null) {
|
if (mFragment != null) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user