Snap for 11426397 from c20d8d2977 to 24Q2-release
Change-Id: I8f9cdaffe0ceac732e4ee756c2e139cee0be37d3
This commit is contained in:
12
TEST_MAPPING
12
TEST_MAPPING
@@ -6,14 +6,20 @@
|
||||
{
|
||||
"name": "SettingsUnitTests",
|
||||
"options": [
|
||||
{
|
||||
"include-filter": "com.android.settings.password"
|
||||
},
|
||||
{
|
||||
"include-filter": "com.android.settings.biometrics"
|
||||
},
|
||||
{
|
||||
"include-filter": "com.android.settings.biometrics2"
|
||||
},
|
||||
{
|
||||
"include-filter": "com.android.settings.password"
|
||||
},
|
||||
{
|
||||
"include-filter": "com.android.settings.safetycenter"
|
||||
},
|
||||
{
|
||||
"include-filter": "com.android.settings.security"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -11613,9 +11613,9 @@
|
||||
other {# SIMs are available on this device, but only one can be used at a time}
|
||||
}</string>
|
||||
<!-- String indicating that we are activating the profile [CHAR LIMIT=NONE] -->
|
||||
<string name="choose_sim_activating">Activating<xliff:g id="ellipsis" example="...">…</xliff:g></string>
|
||||
<string name="choose_sim_activating">Turning on<xliff:g id="ellipsis" example="...">…</xliff:g></string>
|
||||
<!-- String indicating that we failed to activate the selected profile [CHAR LIMIT=NONE] -->
|
||||
<string name="choose_sim_could_not_activate">Couldn\u2019t activate this SIM right now</string>
|
||||
<string name="choose_sim_could_not_activate">Couldn\u2019t turn on this SIM right now</string>
|
||||
|
||||
<!-- Strings for switch SIM confirmation dialog. -->
|
||||
<!-- The title text of switch SIM confirmation dialog. [CHAR LIMIT=NONE] -->
|
||||
@@ -12882,4 +12882,7 @@
|
||||
|
||||
<!-- Authority of the content provider that support methods restartPhoneProcess and restartRild. Will be overlaid by OEM.-->
|
||||
<string name="reset_telephony_stack_content_provider_authority" translatable="false"></string>
|
||||
|
||||
<!--Text for Stylus Pointer Icon preference -->
|
||||
<string name="show_stylus_pointer_icon">Show pointer while hovering</string>
|
||||
</resources>
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.hardware.input.InputSettings;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
@@ -73,6 +74,8 @@ public class StylusDevicesController extends AbstractPreferenceController implem
|
||||
static final String KEY_IGNORE_BUTTON = "ignore_button";
|
||||
@VisibleForTesting
|
||||
static final String KEY_DEFAULT_NOTES = "default_notes";
|
||||
@VisibleForTesting
|
||||
static final String KEY_SHOW_STYLUS_POINTER_ICON = "show_stylus_pointer_icon";
|
||||
|
||||
private static final String TAG = "StylusDevicesController";
|
||||
|
||||
@@ -181,6 +184,26 @@ public class StylusDevicesController extends AbstractPreferenceController implem
|
||||
return pref;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private SwitchPreferenceCompat createShowStylusPointerIconPreference(
|
||||
SwitchPreferenceCompat preference) {
|
||||
if (!mContext.getResources()
|
||||
.getBoolean(com.android.internal.R.bool.config_enableStylusPointerIcon)) {
|
||||
// If the config is not enabled, no need to show the preference to user
|
||||
return null;
|
||||
}
|
||||
SwitchPreferenceCompat pref = preference == null ? new SwitchPreferenceCompat(mContext)
|
||||
: preference;
|
||||
pref.setKey(KEY_SHOW_STYLUS_POINTER_ICON);
|
||||
pref.setTitle(mContext.getString(R.string.show_stylus_pointer_icon));
|
||||
pref.setIcon(R.drawable.ic_stylus);
|
||||
pref.setOnPreferenceClickListener(this);
|
||||
pref.setChecked(Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_POINTER_ICON_ENABLED,
|
||||
InputSettings.DEFAULT_STYLUS_POINTER_ICON_ENABLED) == 1);
|
||||
return pref;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
String key = preference.getKey();
|
||||
@@ -213,6 +236,11 @@ public class StylusDevicesController extends AbstractPreferenceController implem
|
||||
Secure.STYLUS_BUTTONS_ENABLED,
|
||||
((TwoStatePreference) preference).isChecked() ? 0 : 1);
|
||||
break;
|
||||
case KEY_SHOW_STYLUS_POINTER_ICON:
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Secure.STYLUS_POINTER_ICON_ENABLED,
|
||||
((SwitchPreferenceCompat) preference).isChecked() ? 1 : 0);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -268,6 +296,13 @@ public class StylusDevicesController extends AbstractPreferenceController implem
|
||||
if (buttonPref == null) {
|
||||
mPreferencesContainer.addPreference(createButtonPressPreference());
|
||||
}
|
||||
SwitchPreferenceCompat currShowStylusPointerIconPref = mPreferencesContainer
|
||||
.findPreference(KEY_SHOW_STYLUS_POINTER_ICON);
|
||||
Preference showStylusPointerIconPref =
|
||||
createShowStylusPointerIconPreference(currShowStylusPointerIconPref);
|
||||
if (currShowStylusPointerIconPref == null && showStylusPointerIconPref != null) {
|
||||
mPreferencesContainer.addPreference(showStylusPointerIconPref);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean currentInputMethodSupportsHandwriting() {
|
||||
|
||||
@@ -20,6 +20,7 @@ import static androidx.lifecycle.Lifecycle.Event.ON_START;
|
||||
import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -143,6 +144,7 @@ public class ConvertToEsimPreferenceController extends TelephonyBasePreferenceCo
|
||||
Intent intent = new Intent(EuiccManager.ACTION_CONVERT_TO_EMBEDDED_SUBSCRIPTION);
|
||||
intent.putExtra("subId", mSubId);
|
||||
mContext.startActivity(intent);
|
||||
((Activity) mContext).finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,16 @@ public final class BiometricsSafetySource {
|
||||
}
|
||||
final Context profileParentContext =
|
||||
context.createContextAsUser(profileParentUserHandle, 0);
|
||||
if (android.os.Flags.allowPrivateProfile() && userManager.isPrivateProfile()) {
|
||||
// SC always expects a response from the source if the broadcast has been sent for this
|
||||
// source, therefore, we need to send a null SafetySourceData.
|
||||
SafetyCenterManagerWrapper.get().setSafetySourceData(
|
||||
context,
|
||||
SAFETY_SOURCE_ID,
|
||||
/* safetySourceData= */ null,
|
||||
safetyEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
final BiometricNavigationUtils biometricNavigationUtils =
|
||||
new BiometricNavigationUtils(userId);
|
||||
|
||||
@@ -22,6 +22,8 @@ import android.safetycenter.SafetyEvent;
|
||||
import android.safetycenter.SafetySourceData;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
|
||||
/** A wrapper for the SafetyCenterManager system service. */
|
||||
@@ -49,7 +51,7 @@ public class SafetyCenterManagerWrapper {
|
||||
|
||||
/** Sets the latest safety source data for Safety Center. */
|
||||
public void setSafetySourceData(Context context, String safetySourceId,
|
||||
SafetySourceData safetySourceData,
|
||||
@Nullable SafetySourceData safetySourceData,
|
||||
SafetyEvent safetyEvent) {
|
||||
SafetyCenterManager safetyCenterManager =
|
||||
context.getSystemService(SafetyCenterManager.class);
|
||||
|
||||
@@ -221,7 +221,7 @@ public class StylusDevicesControllerTest {
|
||||
|
||||
showScreen(controller);
|
||||
|
||||
assertThat(mPreferenceContainer.getPreferenceCount()).isEqualTo(3);
|
||||
assertThat(mPreferenceContainer.getPreferenceCount()).isEqualTo(4);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -249,11 +249,12 @@ public class StylusDevicesControllerTest {
|
||||
@Test
|
||||
public void btStylusInputDevice_showsAllPreferences() {
|
||||
showScreen(mController);
|
||||
|
||||
Preference defaultNotesPref = mPreferenceContainer.getPreference(0);
|
||||
Preference handwritingPref = mPreferenceContainer.getPreference(1);
|
||||
Preference buttonPref = mPreferenceContainer.getPreference(2);
|
||||
Preference stylusPointerIconPref = mPreferenceContainer.getPreference(3);
|
||||
|
||||
assertThat(mPreferenceContainer.getPreferenceCount()).isEqualTo(3);
|
||||
assertThat(defaultNotesPref.getTitle().toString()).isEqualTo(
|
||||
mContext.getString(R.string.stylus_default_notes_app));
|
||||
assertThat(defaultNotesPref.isVisible()).isTrue();
|
||||
@@ -263,6 +264,9 @@ public class StylusDevicesControllerTest {
|
||||
assertThat(buttonPref.getTitle().toString()).isEqualTo(
|
||||
mContext.getString(R.string.stylus_ignore_button));
|
||||
assertThat(buttonPref.isVisible()).isTrue();
|
||||
assertThat(stylusPointerIconPref.getTitle().toString()).isEqualTo(
|
||||
mContext.getString(R.string.show_stylus_pointer_icon));
|
||||
assertThat(stylusPointerIconPref.isVisible()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -551,6 +555,46 @@ public class StylusDevicesControllerTest {
|
||||
Secure.STYLUS_BUTTONS_ENABLED, -1)).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stylusPointerIconPreference_checkedWhenFlagTrue() {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_POINTER_ICON_ENABLED, 1);
|
||||
|
||||
showScreen(mController);
|
||||
SwitchPreferenceCompat stylusPointerIconPref =
|
||||
(SwitchPreferenceCompat) mPreferenceContainer.getPreference(3);
|
||||
|
||||
assertThat(stylusPointerIconPref.isChecked()).isEqualTo(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stylusPointerIconPreference_uncheckedWhenFlagFalse() {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_POINTER_ICON_ENABLED, 0);
|
||||
|
||||
showScreen(mController);
|
||||
SwitchPreferenceCompat stylusPointerIconPref =
|
||||
(SwitchPreferenceCompat) mPreferenceContainer.getPreference(3);
|
||||
|
||||
assertThat(stylusPointerIconPref.isChecked()).isEqualTo(false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stylusPointerIconPreference_updatesFlagOnClick() {
|
||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
||||
Settings.Secure.STYLUS_POINTER_ICON_ENABLED, 0);
|
||||
|
||||
showScreen(mController);
|
||||
SwitchPreferenceCompat stylusPointerIconPref =
|
||||
(SwitchPreferenceCompat) mPreferenceContainer.getPreference(3);
|
||||
|
||||
stylusPointerIconPref.performClick();
|
||||
|
||||
assertThat(stylusPointerIconPref.isChecked()).isEqualTo(true);
|
||||
assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Secure.STYLUS_POINTER_ICON_ENABLED, -1)).isEqualTo(1);
|
||||
}
|
||||
|
||||
private void showScreen(StylusDevicesController controller) {
|
||||
controller.displayPreference(mScreen);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ import static org.mockito.Mockito.when;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.platform.test.annotations.RequiresFlagsDisabled;
|
||||
import android.platform.test.flag.junit.CheckFlagsRule;
|
||||
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
|
||||
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
@@ -33,6 +36,7 @@ import com.android.settings.R;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -43,10 +47,14 @@ import org.robolectric.RuntimeEnvironment;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@RequiresFlagsDisabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
|
||||
public class NfcForegroundPreferenceControllerTest {
|
||||
|
||||
private static final String PREF_KEY = PaymentSettingsTest.FOREGROUND_KEY;
|
||||
|
||||
@Rule
|
||||
public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
|
||||
|
||||
@Mock
|
||||
private PaymentBackend mPaymentBackend;
|
||||
@Mock
|
||||
|
||||
@@ -101,18 +101,20 @@ public class FakeFeatureFactory extends FeatureFactory {
|
||||
public FastPairFeatureProvider mFastPairFeatureProvider;
|
||||
public PrivateSpaceLoginFeatureProvider mPrivateSpaceLoginFeatureProvider;
|
||||
|
||||
/**
|
||||
* Call this in {@code @Before} method of the test class to use fake factory.
|
||||
*/
|
||||
/** Call this in {@code @Before} method of the test class to use fake factory. */
|
||||
public static FakeFeatureFactory setupForTest() {
|
||||
FakeFeatureFactory factory = new FakeFeatureFactory();
|
||||
setFactory(getAppContext(), factory);
|
||||
try {
|
||||
setFactory(getAppContext(), factory);
|
||||
} catch (NoSuchMethodError ex) {
|
||||
// The getAppContext() @JvmStatic method doesn't appear to generated in AOSP. Falling
|
||||
// back to using the companion object method instead.
|
||||
setFactory(FeatureFactory.Companion.getAppContext(), factory);
|
||||
}
|
||||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* FeatureFactory constructor.
|
||||
*/
|
||||
/** FeatureFactory constructor. */
|
||||
public FakeFeatureFactory() {
|
||||
supportFeatureProvider = mock(SupportFeatureProvider.class);
|
||||
metricsFeatureProvider = mock(MetricsFeatureProvider.class);
|
||||
|
||||
Reference in New Issue
Block a user