Merge "Clear caller identity in IPC methods" am: 696a2013f5 am: f3be3e1787
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2583220 Change-Id: I39c3293a7c58c01b19db684d7492f191f41bdeee Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
f29b3a88ea
1 changed files with 14 additions and 10 deletions
|
|
@ -210,8 +210,12 @@ public class AutomaticOnOffKeepaliveTracker {
|
|||
this.mKi = Objects.requireNonNull(ki);
|
||||
mCallback = ki.mCallback;
|
||||
mUnderpinnedNetwork = underpinnedNetwork;
|
||||
if (autoOnOff && mDependencies.isFeatureEnabled(AUTOMATIC_ON_OFF_KEEPALIVE_VERSION,
|
||||
true /* defaultEnabled */)) {
|
||||
// Reading DeviceConfig will check if the calling uid and calling package name are the
|
||||
// same. Clear calling identity to align the calling uid and package
|
||||
final boolean enabled = BinderUtils.withCleanCallingIdentity(
|
||||
() -> mDependencies.isFeatureEnabled(AUTOMATIC_ON_OFF_KEEPALIVE_VERSION,
|
||||
true /* defaultEnabled */));
|
||||
if (autoOnOff && enabled) {
|
||||
mAutomaticOnOffState = STATE_ENABLED;
|
||||
if (null == ki.mFd) {
|
||||
throw new IllegalArgumentException("fd can't be null with automatic "
|
||||
|
|
@ -583,8 +587,12 @@ public class AutomaticOnOffKeepaliveTracker {
|
|||
*/
|
||||
public void dump(IndentingPrintWriter pw) {
|
||||
mKeepaliveTracker.dump(pw);
|
||||
final boolean featureEnabled = mDependencies.isFeatureEnabled(
|
||||
AUTOMATIC_ON_OFF_KEEPALIVE_VERSION, true /* defaultEnabled */);
|
||||
// Reading DeviceConfig will check if the calling uid and calling package name are the same.
|
||||
// Clear calling identity to align the calling uid and package so that it won't fail if cts
|
||||
// would like to call dump()
|
||||
final boolean featureEnabled = BinderUtils.withCleanCallingIdentity(
|
||||
() -> mDependencies.isFeatureEnabled(AUTOMATIC_ON_OFF_KEEPALIVE_VERSION,
|
||||
true /* defaultEnabled */));
|
||||
pw.println("AutomaticOnOff enabled: " + featureEnabled);
|
||||
pw.increaseIndent();
|
||||
for (AutomaticOnOffKeepalive autoKi : mAutomaticOnOffKeepalives) {
|
||||
|
|
@ -837,12 +845,8 @@ public class AutomaticOnOffKeepaliveTracker {
|
|||
* @return whether the feature is enabled
|
||||
*/
|
||||
public boolean isFeatureEnabled(@NonNull final String name, final boolean defaultEnabled) {
|
||||
// Reading DeviceConfig will check if the calling uid and calling package name are the
|
||||
// same. Clear calling identity to align the calling uid and package so that it won't
|
||||
// fail if cts would like to do the dump()
|
||||
return BinderUtils.withCleanCallingIdentity(() ->
|
||||
DeviceConfigUtils.isFeatureEnabled(mContext, NAMESPACE_TETHERING, name,
|
||||
DeviceConfigUtils.TETHERING_MODULE_NAME, defaultEnabled));
|
||||
return DeviceConfigUtils.isFeatureEnabled(mContext, NAMESPACE_TETHERING, name,
|
||||
DeviceConfigUtils.TETHERING_MODULE_NAME, defaultEnabled);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue