Snap for 7185571 from c08943784c to sc-v2-release
Change-Id: Ib21143107a76c64146aa2bc8fd57fd164a01aad0
This commit is contained in:
@@ -309,6 +309,7 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
mMainSwitch = findViewById(R.id.switch_bar);
|
||||
if (mMainSwitch != null) {
|
||||
mMainSwitch.setMetricsTag(getMetricsTag());
|
||||
mMainSwitch.setTranslationZ(findViewById(R.id.main_content).getTranslationZ() + 1);
|
||||
}
|
||||
|
||||
// see if we should show Back/Next buttons
|
||||
|
||||
@@ -200,8 +200,6 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|
||||
mSwitchBar = ((SettingsActivity) getActivity()).getSwitchBar();
|
||||
mSwitchBar.setTitle(getContext().getString(R.string.developer_options_main_switch_title));
|
||||
mSwitchBar.show();
|
||||
mSwitchBar.setTranslationZ(
|
||||
getActivity().findViewById(R.id.main_content).getTranslationZ() + 1);
|
||||
mSwitchBarController = new DevelopmentSwitchBarController(
|
||||
this /* DevelopmentSettings */, mSwitchBar, mIsAvailable,
|
||||
getSettingsLifecycle());
|
||||
|
||||
@@ -26,8 +26,13 @@ import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
@@ -97,15 +102,6 @@ public class ScreenTimeoutSettings extends RadioButtonPickerFragment implements
|
||||
mPrivacyPreference.setTitle(R.string.adaptive_sleep_privacy);
|
||||
mPrivacyPreference.setSelectable(false);
|
||||
mPrivacyPreference.setLayoutResource(R.layout.preference_footer);
|
||||
|
||||
mDisableOptionsPreference = new FooterPreference(context);
|
||||
mDisableOptionsPreference.setLayoutResource(R.layout.preference_footer);
|
||||
mDisableOptionsPreference.setTitle(R.string.admin_disabled_other_options);
|
||||
mDisableOptionsPreference.setIcon(R.drawable.ic_info_outline_24dp);
|
||||
|
||||
// The 'disabled by admin' preference should always be at the end of the setting page.
|
||||
mDisableOptionsPreference.setOrder(DEFAULT_ORDER_OF_LOWEST_PREFERENCE);
|
||||
mPrivacyPreference.setOrder(DEFAULT_ORDER_OF_LOWEST_PREFERENCE - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -138,14 +134,6 @@ public class ScreenTimeoutSettings extends RadioButtonPickerFragment implements
|
||||
final PreferenceScreen screen = getPreferenceScreen();
|
||||
screen.removeAll();
|
||||
|
||||
if (mAdmin != null) {
|
||||
mDisableOptionsPreference.setOnPreferenceClickListener(p -> {
|
||||
RestrictedLockUtils.sendShowAdminSupportDetailsIntent(getContext(), mAdmin);
|
||||
return true;
|
||||
});
|
||||
screen.addPreference(mDisableOptionsPreference);
|
||||
}
|
||||
|
||||
final List<? extends CandidateInfo> candidateList = getCandidates();
|
||||
if (candidateList == null) {
|
||||
return;
|
||||
@@ -165,14 +153,43 @@ public class ScreenTimeoutSettings extends RadioButtonPickerFragment implements
|
||||
}
|
||||
|
||||
if (mAdmin != null) {
|
||||
mDisableOptionsPreference.setOnPreferenceClickListener(p -> {
|
||||
RestrictedLockUtils.sendShowAdminSupportDetailsIntent(getContext(), mAdmin);
|
||||
return true;
|
||||
});
|
||||
setupDisabledFooterPreference();
|
||||
screen.addPreference(mDisableOptionsPreference);
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void setupDisabledFooterPreference() {
|
||||
final String textDisabledByAdmin = getResources().getString(
|
||||
R.string.admin_disabled_other_options);
|
||||
final String textMoreDetails = getResources().getString(R.string.admin_more_details);
|
||||
|
||||
final SpannableString spannableString = new SpannableString(
|
||||
textDisabledByAdmin + System.lineSeparator() + textMoreDetails);
|
||||
final ClickableSpan clickableSpan = new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
RestrictedLockUtils.sendShowAdminSupportDetailsIntent(getContext(), mAdmin);
|
||||
}
|
||||
};
|
||||
|
||||
if (textDisabledByAdmin != null && textMoreDetails != null) {
|
||||
spannableString.setSpan(clickableSpan, textDisabledByAdmin.length() + 1,
|
||||
textDisabledByAdmin.length() + textMoreDetails.length() + 1,
|
||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
|
||||
mDisableOptionsPreference = new FooterPreference(getContext());
|
||||
mDisableOptionsPreference.setLayoutResource(R.layout.preference_footer);
|
||||
mDisableOptionsPreference.setTitle(spannableString);
|
||||
mDisableOptionsPreference.setSelectable(false);
|
||||
mDisableOptionsPreference.setIcon(R.drawable.ic_info_outline_24dp);
|
||||
|
||||
// The 'disabled by admin' preference should always be at the end of the setting page.
|
||||
mDisableOptionsPreference.setOrder(DEFAULT_ORDER_OF_LOWEST_PREFERENCE);
|
||||
mPrivacyPreference.setOrder(DEFAULT_ORDER_OF_LOWEST_PREFERENCE - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultKey() {
|
||||
return getCurrentSystemScreenTimeout(getContext());
|
||||
|
||||
@@ -16,11 +16,14 @@
|
||||
|
||||
package com.android.settings.network.ims;
|
||||
|
||||
import static android.telephony.ims.ProvisioningManager.KEY_VOIMS_OPT_IN_STATUS;
|
||||
|
||||
import android.content.Context;
|
||||
import android.telecom.TelecomManager;
|
||||
import android.telephony.AccessNetworkConstants;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.ims.ImsException;
|
||||
import android.telephony.ims.ProvisioningManager;
|
||||
import android.telephony.ims.feature.MmTelFeature;
|
||||
import android.telephony.ims.stub.ImsRegistrationImplBase;
|
||||
import android.util.Log;
|
||||
@@ -133,4 +136,15 @@ public class VolteQueryImsState extends ImsQueryController {
|
||||
}
|
||||
return isEnabledByUser(mSubId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get VoIMS opt-in configuration.
|
||||
*
|
||||
* @return true when VoIMS opt-in has been enabled, otherwise false
|
||||
*/
|
||||
public boolean isVoImsOptInEnabled() {
|
||||
int voImsOptInStatus = ProvisioningManager.createForSubscriptionId(mSubId)
|
||||
.getProvisioningIntValue(KEY_VOIMS_OPT_IN_STATUS);
|
||||
return voImsOptInStatus == ProvisioningManager.PROVISIONING_VALUE_ENABLED;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,12 +107,18 @@ public class Enhanced4gBasePreferenceController extends TelephonyTogglePreferenc
|
||||
if (!isModeMatched()) {
|
||||
return CONDITIONALLY_UNAVAILABLE;
|
||||
}
|
||||
final VolteQueryImsState queryState = queryImsState(subId);
|
||||
// Show VoLTE settings if VoIMS opt-in has been enabled irrespective of other VoLTE settings
|
||||
if (queryState.isVoImsOptInEnabled()) {
|
||||
return AVAILABLE;
|
||||
}
|
||||
|
||||
final PersistableBundle carrierConfig = getCarrierConfigForSubId(subId);
|
||||
if ((carrierConfig == null)
|
||||
|| carrierConfig.getBoolean(CarrierConfigManager.KEY_HIDE_ENHANCED_4G_LTE_BOOL)) {
|
||||
return CONDITIONALLY_UNAVAILABLE;
|
||||
}
|
||||
final VolteQueryImsState queryState = queryImsState(subId);
|
||||
|
||||
if (!queryState.isReadyToVoLte()) {
|
||||
return CONDITIONALLY_UNAVAILABLE;
|
||||
}
|
||||
|
||||
@@ -176,6 +176,7 @@ public class SettingsMainSwitchPreference extends TwoStatePreference {
|
||||
* Update the status of switch but doesn't notify the mOnBeforeListener.
|
||||
*/
|
||||
public void setCheckedInternal(boolean checked) {
|
||||
super.setChecked(checked);
|
||||
if (mMainSwitchBar != null) {
|
||||
mMainSwitchBar.setCheckedInternal(checked);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.atLeast;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.spy;
|
||||
@@ -138,6 +139,7 @@ public class ScreenTimeoutSettingsTest {
|
||||
public void updateCandidates_enforcedAdmin_showDisabledByAdminPreference() {
|
||||
mSettings.mAdmin = new RestrictedLockUtils.EnforcedAdmin();
|
||||
mSettings.mDisableOptionsPreference = mDisableOptionsPreference;
|
||||
doNothing().when(mSettings).setupDisabledFooterPreference();
|
||||
|
||||
mSettings.updateCandidates();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user