Update to ConnectivityService to use utils
Update to ConnectivityService to use permission utils to validate the existence of a system feature. Bug: 210485380 Test: atest FrameworksNetTests: com.android.server.ConnectivityServiceTest Change-Id: Ia537cc5b37ef8d80f49f1a83ba572b3b8a9f6874
This commit is contained in:
@@ -10235,12 +10235,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void enforceAutomotiveDevice() {
|
private void enforceAutomotiveDevice() {
|
||||||
final boolean isAutomotiveDevice =
|
PermissionUtils.enforceSystemFeature(mContext, PackageManager.FEATURE_AUTOMOTIVE,
|
||||||
mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
|
"setOemNetworkPreference() is only available on automotive devices.");
|
||||||
if (!isAutomotiveDevice) {
|
|
||||||
throw new UnsupportedOperationException(
|
|
||||||
"setOemNetworkPreference() is only available on automotive devices.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user