Skip to content

Commit 386e036

Browse files
committed
Update TestDPC to use new API for 5G slicing
Switch TestDPC to using the setPreferentialNetworkServiceEnabled and isPreferentialNetworkServiceEnabled methods for controlling network slicing. Bug: 183663019 Test: That it compiles. Change-Id: I31254726b9d70c9c2ee57a9233a1679b2482e467
1 parent bd422f6 commit 386e036

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

app/src/main/java/com/afwsamples/testdpc/policy/PolicyManagementFragment.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,8 @@ public class PolicyManagementFragment extends BaseSearchablePolicyPreferenceFrag
350350
private static final String LOCK_NOW_KEY = "lock_now";
351351
private static final String SET_ACCESSIBILITY_SERVICES_KEY = "set_accessibility_services";
352352
private static final String SET_ALWAYS_ON_VPN_KEY = "set_always_on_vpn";
353-
private static final String SET_GET_NETWORK_PREFERENCE_STATUS =
354-
"set_get_network_preference_status";
353+
private static final String SET_GET_PREFERENTIAL_NETWORK_SERVICE_STATUS =
354+
"set_get_preferential_network_service_status";
355355
private static final String SET_GLOBAL_HTTP_PROXY_KEY = "set_global_http_proxy";
356356
private static final String SET_LOCK_TASK_FEATURES_KEY = "set_lock_task_features";
357357
private static final String CLEAR_GLOBAL_HTTP_PROXY_KEY = "clear_global_http_proxy";
@@ -476,7 +476,7 @@ public class PolicyManagementFragment extends BaseSearchablePolicyPreferenceFrag
476476
private SwitchPreference mDisableScreenCaptureSwitchPreference;
477477
private DpcSwitchPreference mDisableScreenCaptureOnParentSwitchPreference;
478478
private SwitchPreference mMuteAudioSwitchPreference;
479-
private SwitchPreference mEnterpriseNetworkPreferenceSwitchPreference;
479+
private SwitchPreference mPreferentialNetworkServiceSwitchPreference;
480480

481481
private DpcPreference mDisableStatusBarPreference;
482482
private DpcPreference mReenableStatusBarPreference;
@@ -605,12 +605,12 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
605605
MUTE_AUDIO_KEY);
606606
mMuteAudioSwitchPreference.setOnPreferenceChangeListener(this);
607607

608-
mEnterpriseNetworkPreferenceSwitchPreference = (SwitchPreference) findPreference(
609-
SET_GET_NETWORK_PREFERENCE_STATUS);
610-
mEnterpriseNetworkPreferenceSwitchPreference.setOnPreferenceChangeListener(this);
608+
mPreferentialNetworkServiceSwitchPreference = (SwitchPreference) findPreference(
609+
SET_GET_PREFERENTIAL_NETWORK_SERVICE_STATUS);
610+
mPreferentialNetworkServiceSwitchPreference.setOnPreferenceChangeListener(this);
611611
if (mIsProfileOwner) {
612-
mEnterpriseNetworkPreferenceSwitchPreference.setChecked(
613-
mDevicePolicyManager.isEnterpriseNetworkPreferenceEnabled());
612+
mPreferentialNetworkServiceSwitchPreference.setChecked(
613+
mDevicePolicyManager.isPreferentialNetworkServiceEnabled());
614614
}
615615
findPreference(LOCK_SCREEN_POLICY_KEY).setOnPreferenceClickListener(this);
616616
findPreference(PASSWORD_CONSTRAINTS_KEY).setOnPreferenceClickListener(this);
@@ -1551,10 +1551,10 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
15511551
(Boolean) newValue);
15521552
reloadMuteAudioUi();
15531553
return true;
1554-
case SET_GET_NETWORK_PREFERENCE_STATUS:
1555-
mDevicePolicyManager.setEnterpriseNetworkPreferenceEnabled((Boolean) newValue);
1554+
case SET_GET_PREFERENTIAL_NETWORK_SERVICE_STATUS:
1555+
mDevicePolicyManager.setPreferentialNetworkServiceEnabled((Boolean) newValue);
15561556
showToast(Boolean.toString(
1557-
mDevicePolicyManager.isEnterpriseNetworkPreferenceEnabled()));
1557+
mDevicePolicyManager.isPreferentialNetworkServiceEnabled()));
15581558
return true;
15591559
case STAY_ON_WHILE_PLUGGED_IN:
15601560
mDevicePolicyManager.setGlobalSetting(mAdminComponentName,

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@
809809
<!-- Strings for networking -->
810810
<string name="networking_management_title">Networking</string>
811811
<string name="set_always_on_vpn">Set always-on VPN</string>
812-
<string name="set_get_network_preference_status">Network Preference Status</string>
812+
<string name="set_get_preferential_network_service_status">Preferential Network Service Status</string>
813813
<string name="set_global_http_proxy">Set global HTTP proxy</string>
814814
<string name="clear_global_http_proxy">Clear global HTTP proxy</string>
815815
<string name="networking_proxy_host">Host</string>

app/src/main/res/xml/device_policy_header.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,8 @@
503503
android:title="@string/set_always_on_vpn"
504504
testdpc:minSdkVersion="N" />
505505
<com.afwsamples.testdpc.common.preference.DpcSwitchPreference
506-
android:key="set_get_network_preference_status"
507-
android:title="@string/set_get_network_preference_status"
506+
android:key="set_get_preferential_network_service_status"
507+
android:title="@string/set_get_preferential_network_service_status"
508508
testdpc:admin="profileOwner"
509509
testdpc:minSdkVersion="S"
510510
testdpc:user="managedProfile" />

0 commit comments

Comments
 (0)