Merge "Use SettingsShim to hide different implementation in shim" into sc-dev am: 4547356487

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14467433

Change-Id: Iee71677f0cf215e546fc9dca53d72e0f67edd115
This commit is contained in:
TreeHugger Robot
2021-05-15 06:49:28 +00:00
committed by Automerger Merge Worker
2 changed files with 7 additions and 2 deletions

View File

@@ -41,6 +41,7 @@ java_defaults {
"net-utils-framework-common",
"net-utils-device-common",
"netd-client",
"NetworkStackApiCurrentShims",
],
libs: [
"framework-connectivity",

View File

@@ -46,13 +46,14 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.provider.Settings;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.android.internal.annotations.VisibleForTesting;
import com.android.networkstack.apishim.SettingsShimImpl;
import com.android.networkstack.apishim.common.SettingsShim;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -66,6 +67,7 @@ public class TetheringService extends Service {
private static final String TAG = TetheringService.class.getSimpleName();
private TetheringConnector mConnector;
private SettingsShim mSettingsShim;
@Override
public void onCreate() {
@@ -73,6 +75,8 @@ public class TetheringService extends Service {
// The Tethering object needs a fully functional context to start, so this can't be done
// in the constructor.
mConnector = new TetheringConnector(makeTethering(deps), TetheringService.this);
mSettingsShim = SettingsShimImpl.newInstance();
}
/**
@@ -294,7 +298,7 @@ public class TetheringService extends Service {
boolean checkAndNoteWriteSettingsOperation(@NonNull Context context, int uid,
@NonNull String callingPackage, @Nullable String callingAttributionTag,
boolean throwException) {
return Settings.checkAndNoteWriteSettingsOperation(context, uid, callingPackage,
return mSettingsShim.checkAndNoteWriteSettingsOperation(context, uid, callingPackage,
callingAttributionTag, throwException);
}