Merge "Implement Settings#checkAndNoteChangeNetworkStateOperation on CS" am: 1ea28296e6

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1560476

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4ad8f2d923e9415460c02002750a3766978272a6
This commit is contained in:
Paul Hu
2021-03-03 01:34:48 +00:00
committed by Automerger Merge Worker

View File

@@ -2245,31 +2245,6 @@ public class ConnectivityManager {
}
}
/* TODO: These permissions checks don't belong in client-side code. Move them to
* services.jar, possibly in com.android.server.net. */
/** {@hide} */
public static final void enforceChangePermission(Context context,
String callingPkg, String callingAttributionTag) {
int uid = Binder.getCallingUid();
checkAndNoteChangeNetworkStateOperation(context, uid, callingPkg,
callingAttributionTag, true /* throwException */);
}
/**
* Check if the package is a allowed to change the network state. This also accounts that such
* an access happened.
*
* @return {@code true} iff the package is allowed to change the network state.
*/
// TODO: Remove method and replace with direct call once R code is pushed to AOSP
private static boolean checkAndNoteChangeNetworkStateOperation(@NonNull Context context,
int uid, @NonNull String callingPackage, @Nullable String callingAttributionTag,
boolean throwException) {
return Settings.checkAndNoteChangeNetworkStateOperation(context, uid, callingPackage,
throwException);
}
/**
* Check if the package is a allowed to write settings. This also accounts that such an access
* happened.