Refactor to use the utils class.
Bug: 298076922 Change-Id: I0085fdf7594d0ba9243a7b44600252d8c5b21608
This commit is contained in:
@@ -36,32 +36,8 @@ public class ContentProtectionPreferenceController extends BasePreferenceControl
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
if (!settingUiEnabled() || getContentProtectionServiceComponentName() == null) {
|
||||
return UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
return AVAILABLE;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@Nullable
|
||||
protected String getContentProtectionServiceFlatComponentName() {
|
||||
return mContext.getString(config_defaultContentProtectionService);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ComponentName getContentProtectionServiceComponentName() {
|
||||
String flatComponentName = getContentProtectionServiceFlatComponentName();
|
||||
if (flatComponentName == null) {
|
||||
return null;
|
||||
}
|
||||
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);
|
||||
return ContentProtectionPreferenceUtils.isAvailable(mContext)
|
||||
? AVAILABLE
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user