Snap for 5778854 from 37b38f872f
to qt-c2f2-release
Change-Id: I65f2c3f99c9767109fb4aa653b2e4afcfeedfa51
This commit is contained in:
@@ -72,6 +72,13 @@
|
||||
android:summary="@string/lock_screen_notifs_redact_work_summary"
|
||||
settings:controller="com.android.settings.notification.RedactNotificationPreferenceController" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="notification_lockscreen_bypass"
|
||||
android:title="@string/lockscreen_bypass_title"
|
||||
android:summary="@string/lockscreen_bypass_summary"
|
||||
settings:searchable="false"
|
||||
settings:controller="com.android.settings.biometrics.face.FaceSettingsLockscreenBypassPreferenceController" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
|
@@ -30,6 +30,13 @@
|
||||
android:summary="@string/summary_placeholder"
|
||||
settings:keywords="@string/keywords_lock_screen_notif"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="security_dispaly_lockscreen_bypass"
|
||||
android:title="@string/lockscreen_bypass_title"
|
||||
android:summary="@string/lockscreen_bypass_summary"
|
||||
settings:searchable="false"
|
||||
settings:controller="com.android.settings.biometrics.face.FaceSettingsLockscreenBypassPreferenceController" />
|
||||
|
||||
<com.android.settingslib.RestrictedSwitchPreference
|
||||
android:key="security_lockscreen_add_users_when_locked"
|
||||
android:title="@string/user_add_on_lockscreen_menu"
|
||||
|
@@ -149,7 +149,6 @@ public class FaceSettings extends DashboardFragment {
|
||||
// Don't show keyguard controller for work profile settings.
|
||||
if (mUserManager.isManagedProfile(mUserId)) {
|
||||
removePreference(FaceSettingsKeyguardPreferenceController.KEY);
|
||||
removePreference(FaceSettingsLockscreenBypassPreferenceController.KEY);
|
||||
}
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
@@ -261,7 +260,6 @@ public class FaceSettings extends DashboardFragment {
|
||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
controllers.add(new FaceSettingsVideoPreferenceController(context));
|
||||
controllers.add(new FaceSettingsKeyguardPreferenceController(context));
|
||||
controllers.add(new FaceSettingsLockscreenBypassPreferenceController(context));
|
||||
controllers.add(new FaceSettingsAppPreferenceController(context));
|
||||
controllers.add(new FaceSettingsAttentionPreferenceController(context));
|
||||
controllers.add(new FaceSettingsRemoveButtonPreferenceController(context));
|
||||
|
@@ -19,6 +19,8 @@ package com.android.settings.biometrics.face;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
@@ -32,16 +34,15 @@ public class FaceSettingsLockscreenBypassPreferenceController
|
||||
|
||||
@VisibleForTesting
|
||||
protected FaceManager mFaceManager;
|
||||
|
||||
public FaceSettingsLockscreenBypassPreferenceController(Context context) {
|
||||
this(context, KEY);
|
||||
}
|
||||
private UserManager mUserManager;
|
||||
|
||||
public FaceSettingsLockscreenBypassPreferenceController(Context context, String preferenceKey) {
|
||||
super(context, preferenceKey);
|
||||
if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE)) {
|
||||
mFaceManager = context.getSystemService(FaceManager.class);
|
||||
}
|
||||
|
||||
mUserManager = context.getSystemService(UserManager.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,6 +76,10 @@ public class FaceSettingsLockscreenBypassPreferenceController
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
if (mUserManager.isManagedProfile(UserHandle.myUserId())) {
|
||||
return UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
if (mFaceManager != null && mFaceManager.isHardwareDetected()) {
|
||||
return mFaceManager.hasEnrolledTemplates() ? AVAILABLE : DISABLED_DEPENDENT_SETTING;
|
||||
} else {
|
||||
|
@@ -61,16 +61,12 @@ public class WifiCallingPreferenceController extends TelephonyBasePreferenceCont
|
||||
PhoneAccountHandle mSimCallManager;
|
||||
private PhoneCallStateListener mPhoneStateListener;
|
||||
private Preference mPreference;
|
||||
private boolean mEditableWfcRoamingMode;
|
||||
private boolean mUseWfcHomeModeForRoaming;
|
||||
|
||||
public WifiCallingPreferenceController(Context context, String key) {
|
||||
super(context, key);
|
||||
mCarrierConfigManager = context.getSystemService(CarrierConfigManager.class);
|
||||
mTelephonyManager = context.getSystemService(TelephonyManager.class);
|
||||
mPhoneStateListener = new PhoneCallStateListener(Looper.getMainLooper());
|
||||
mEditableWfcRoamingMode = true;
|
||||
mUseWfcHomeModeForRoaming = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,9 +125,18 @@ public class WifiCallingPreferenceController extends TelephonyBasePreferenceCont
|
||||
preference.setTitle(title);
|
||||
int resId = com.android.internal.R.string.wifi_calling_off_summary;
|
||||
if (mImsManager.isWfcEnabledByUser()) {
|
||||
boolean wfcRoamingEnabled = mEditableWfcRoamingMode && !mUseWfcHomeModeForRoaming;
|
||||
boolean useWfcHomeModeForRoaming = false;
|
||||
if (mCarrierConfigManager != null) {
|
||||
final PersistableBundle carrierConfig =
|
||||
mCarrierConfigManager.getConfigForSubId(mSubId);
|
||||
if (carrierConfig != null) {
|
||||
useWfcHomeModeForRoaming = carrierConfig.getBoolean(
|
||||
CarrierConfigManager
|
||||
.KEY_USE_WFC_HOME_NETWORK_MODE_IN_ROAMING_NETWORK_BOOL);
|
||||
}
|
||||
}
|
||||
final boolean isRoaming = mTelephonyManager.isNetworkRoaming();
|
||||
int wfcMode = mImsManager.getWfcMode(isRoaming && wfcRoamingEnabled);
|
||||
int wfcMode = mImsManager.getWfcMode(isRoaming && !useWfcHomeModeForRoaming);
|
||||
switch (wfcMode) {
|
||||
case ImsConfig.WfcModeFeatureValueConstants.WIFI_ONLY:
|
||||
resId = com.android.internal.R.string.wfc_mode_wifi_only_summary;
|
||||
@@ -159,16 +164,6 @@ public class WifiCallingPreferenceController extends TelephonyBasePreferenceCont
|
||||
mImsManager = ImsManager.getInstance(mContext, SubscriptionManager.getPhoneId(mSubId));
|
||||
mSimCallManager = mContext.getSystemService(TelecomManager.class)
|
||||
.getSimCallManagerForSubscription(mSubId);
|
||||
if (mCarrierConfigManager != null) {
|
||||
final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSubId);
|
||||
if (carrierConfig != null) {
|
||||
mEditableWfcRoamingMode = carrierConfig.getBoolean(
|
||||
CarrierConfigManager.KEY_EDITABLE_WFC_ROAMING_MODE_BOOL);
|
||||
mUseWfcHomeModeForRoaming = carrierConfig.getBoolean(
|
||||
CarrierConfigManager
|
||||
.KEY_USE_WFC_HOME_NETWORK_MODE_IN_ROAMING_NETWORK_BOOL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class PhoneCallStateListener extends PhoneStateListener {
|
||||
|
@@ -55,7 +55,7 @@ public abstract class RingtonePreferenceControllerBase extends AbstractPreferenc
|
||||
|
||||
final CharSequence summary;
|
||||
if (ringtoneUri == null) {
|
||||
summary = null;
|
||||
summary = mContext.getString(com.android.internal.R.string.ringtone_silent);
|
||||
} else {
|
||||
summary = Ringtone.getTitle(
|
||||
mContext, ringtoneUri, false /* followSettingsUri */, true /* allowRemote */);
|
||||
|
@@ -18,10 +18,12 @@ package com.android.settings.biometrics.face;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.os.UserManager;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.preference.SwitchPreference;
|
||||
@@ -41,6 +43,8 @@ public class FaceSettingsLockscreenBypassPreferenceControllerTest {
|
||||
@Mock
|
||||
private FaceManager mFaceManager;
|
||||
private SwitchPreference mPreference;
|
||||
@Mock
|
||||
private UserManager mUserManager;
|
||||
|
||||
private Context mContext;
|
||||
private FaceSettingsLockscreenBypassPreferenceController mController;
|
||||
@@ -51,8 +55,9 @@ public class FaceSettingsLockscreenBypassPreferenceControllerTest {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mPreference = new SwitchPreference(mContext);
|
||||
|
||||
mController = new FaceSettingsLockscreenBypassPreferenceController(mContext);
|
||||
mController = new FaceSettingsLockscreenBypassPreferenceController(mContext, "test_key");
|
||||
ReflectionHelpers.setField(mController, "mFaceManager", mFaceManager);
|
||||
ReflectionHelpers.setField(mController, "mUserManager", mUserManager);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -62,6 +67,13 @@ public class FaceSettingsLockscreenBypassPreferenceControllerTest {
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAvailable_isManagedProfile_shouldReturnUnsupported() {
|
||||
when(mUserManager.isManagedProfile(anyInt())).thenReturn(true);
|
||||
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_settingIsUpdated() {
|
||||
boolean defaultValue = mContext.getResources().getBoolean(
|
||||
|
@@ -127,10 +127,10 @@ public class WifiCallingPreferenceControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_wfcNonRoaming() {
|
||||
public void updateState_nonRoaming_wfcCellularPreferred() {
|
||||
assertNull(mController.mSimCallManager);
|
||||
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_EDITABLE_WFC_ROAMING_MODE_BOOL, false);
|
||||
// update the config value by calling init again.
|
||||
mCarrierConfig.putBoolean(
|
||||
CarrierConfigManager.KEY_USE_WFC_HOME_NETWORK_MODE_IN_ROAMING_NETWORK_BOOL, true);
|
||||
mController.init(SUB_ID);
|
||||
mController.mImsManager = mImsManager;
|
||||
|
||||
@@ -147,9 +147,10 @@ public class WifiCallingPreferenceControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_wfcRoaming() {
|
||||
public void updateState_roaming_wfcWifiPreferred() {
|
||||
assertNull(mController.mSimCallManager);
|
||||
|
||||
// useWfcHomeModeForRoaming is false by default. In order to check wfc in roaming mode. We
|
||||
// need the device roaming, and not using home mode in roaming network.
|
||||
when(mImsManager.getWfcMode(true)).thenReturn(
|
||||
ImsConfig.WfcModeFeatureValueConstants.WIFI_PREFERRED);
|
||||
when(mImsManager.getWfcMode(false)).thenReturn(
|
||||
|
Reference in New Issue
Block a user