Merge "Protect entry points to add an eSIM when admin restricted" into qt-r1-dev
am: 4685c785b9
Change-Id: Id759b8df825b2be7c0a4abff45630916807c1d19
This commit is contained in:
@@ -20,9 +20,11 @@
|
|||||||
android:key="mobile_network_list_screen"
|
android:key="mobile_network_list_screen"
|
||||||
android:title="@string/network_settings_title">
|
android:title="@string/network_settings_title">
|
||||||
|
|
||||||
<Preference
|
<com.android.settingslib.RestrictedPreference
|
||||||
android:key="add_more"
|
android:key="add_more"
|
||||||
settings:isPreferenceVisible="false"
|
settings:isPreferenceVisible="false"
|
||||||
|
settings:userRestriction="no_config_mobile_networks"
|
||||||
|
settings:useAdminDisabledSummary="true"
|
||||||
android:title="@string/mobile_network_list_add_more"
|
android:title="@string/mobile_network_list_add_more"
|
||||||
android:icon="@drawable/ic_menu_add_activated_tint"
|
android:icon="@drawable/ic_menu_add_activated_tint"
|
||||||
android:order="100" >
|
android:order="100" >
|
||||||
@@ -30,6 +32,6 @@
|
|||||||
<extra android:name="android.telephony.euicc.extra.FORCE_PROVISION"
|
<extra android:name="android.telephony.euicc.extra.FORCE_PROVISION"
|
||||||
android:value="true"/>
|
android:value="true"/>
|
||||||
</intent>
|
</intent>
|
||||||
</Preference>
|
</com.android.settingslib.RestrictedPreference>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
@@ -130,7 +130,7 @@ public class MobileNetworkSummaryController extends AbstractPreferenceController
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void update() {
|
private void update() {
|
||||||
if (mPreference == null) {
|
if (mPreference == null || mPreference.isDisabledByAdmin()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
refreshSummary(mPreference);
|
refreshSummary(mPreference);
|
||||||
|
@@ -42,6 +42,7 @@ import android.text.TextUtils;
|
|||||||
|
|
||||||
import com.android.settings.network.telephony.MobileNetworkActivity;
|
import com.android.settings.network.telephony.MobileNetworkActivity;
|
||||||
import com.android.settings.widget.AddPreference;
|
import com.android.settings.widget.AddPreference;
|
||||||
|
import com.android.settingslib.RestrictedLockUtils;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -373,4 +374,12 @@ public class MobileNetworkSummaryControllerTest {
|
|||||||
verify(mPreference, atLeastOnce()).setAddWidgetEnabled(captor.capture());
|
verify(mPreference, atLeastOnce()).setAddWidgetEnabled(captor.capture());
|
||||||
assertThat(captor.getValue()).isTrue();
|
assertThat(captor.getValue()).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void onResume_disabledByAdmin_prefStaysDisabled() {
|
||||||
|
mPreference.setDisabledByAdmin(new RestrictedLockUtils.EnforcedAdmin());
|
||||||
|
mController.displayPreference(mPreferenceScreen);
|
||||||
|
mController.onResume();
|
||||||
|
verify(mPreference, never()).setEnabled(eq(true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user