Ensure calling package and UID synchronized while calling dump()
This commit clear the calling identity before accessing the DeviceConfig in ConnectivityService#dump(). The calling package of DeviceConfig.getProperties() comes from ActivityThread.currentApplication(). In ConnectivityService#dump(), the caller is ConnectivityService. It's OK to access DeviceConfig from ConnectivityService. The same scenario applies to an app with proper permission accessing DeviceConfig from its own context. However, if cts would like to verify design by calling ConnectivityService#dump(), the calling uid will comes from the binder but package name will stay as ConnectivityService which is 'android'. This will result in a SecurityException says that the package does not match the uid and failed the test. Bug: 255231779 Test: atest CtsNetTestCases FrameworksNetTests Change-Id: I257e246b1cbf3b8a93bee2c326055ced9dfde588
This commit is contained in:
parent
e9fb16acde
commit
18a6e8cf2f
1 changed files with 4 additions and 1 deletions
|
|
@ -249,6 +249,7 @@ import com.android.internal.util.MessageUtils;
|
|||
import com.android.modules.utils.BasicShellCommandHandler;
|
||||
import com.android.modules.utils.build.SdkLevel;
|
||||
import com.android.net.module.util.BaseNetdUnsolicitedEventListener;
|
||||
import com.android.net.module.util.BinderUtils;
|
||||
import com.android.net.module.util.BitUtils;
|
||||
import com.android.net.module.util.CollectionUtils;
|
||||
import com.android.net.module.util.DeviceConfigUtils;
|
||||
|
|
@ -5147,7 +5148,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
description = settingValue + " (?)";
|
||||
}
|
||||
pw.println("Avoid bad wifi setting: " + description);
|
||||
final Boolean configValue = mMultinetworkPolicyTracker.deviceConfigActivelyPreferBadWifi();
|
||||
|
||||
final Boolean configValue = BinderUtils.withCleanCallingIdentity(
|
||||
() -> mMultinetworkPolicyTracker.deviceConfigActivelyPreferBadWifi());
|
||||
if (null == configValue) {
|
||||
description = "unset";
|
||||
} else if (configValue) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue