Use DeviceConfig flag instead of aconfig flag
Bug: 308610589 Test: Units Flag: EXEMPT Change-Id: I3ff34b4048d8c0f0101f74fbab0498f91c7c2409
This commit is contained in:
@@ -15,12 +15,12 @@
|
||||
*/
|
||||
package com.android.settings.security;
|
||||
|
||||
import static android.view.contentprotection.flags.Flags.settingUiEnabled;
|
||||
|
||||
import static com.android.internal.R.string.config_defaultContentProtectionService;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.provider.DeviceConfig;
|
||||
import android.view.contentcapture.ContentCaptureManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -56,4 +56,12 @@ public class ContentProtectionPreferenceController extends BasePreferenceControl
|
||||
}
|
||||
return ComponentName.unflattenFromString(flatComponentName);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
protected boolean settingUiEnabled() {
|
||||
return DeviceConfig.getBoolean(
|
||||
DeviceConfig.NAMESPACE_CONTENT_CAPTURE,
|
||||
ContentCaptureManager.DEVICE_CONFIG_PROPERTY_ENABLE_CONTENT_PROTECTION_RECEIVER,
|
||||
ContentCaptureManager.DEFAULT_ENABLE_CONTENT_PROTECTION_RECEIVER);
|
||||
}
|
||||
}
|
||||
|
@@ -48,6 +48,8 @@ public class ContentProtectionPreferenceControllerTest {
|
||||
|
||||
private ContentProtectionPreferenceController mController;
|
||||
|
||||
private boolean mSettingUiEnabled;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mController = new TestContentProtectionPreferenceController();
|
||||
@@ -55,7 +57,7 @@ public class ContentProtectionPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void isAvailable_flagSettingUiDisabled_isFalse() {
|
||||
mSetFlagsRule.disableFlags(FLAG_SETTING_UI_ENABLED);
|
||||
mSettingUiEnabled = false;
|
||||
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
}
|
||||
@@ -98,7 +100,7 @@ public class ContentProtectionPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void isAvailable_flagSettingUiEnabled_componentNameValid_isTrue() {
|
||||
mSetFlagsRule.enableFlags(FLAG_SETTING_UI_ENABLED);
|
||||
mSettingUiEnabled = true;
|
||||
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
@@ -114,5 +116,10 @@ public class ContentProtectionPreferenceControllerTest {
|
||||
protected String getContentProtectionServiceFlatComponentName() {
|
||||
return mConfigDefaultContentProtectionService;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean settingUiEnabled() {
|
||||
return mSettingUiEnabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user