Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9b60e84b authored by Yan Yan's avatar Yan Yan Committed by Gerrit Code Review
Browse files

Merge "Replace utility classes" into main

parents eb55496c b24eb194
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -40,9 +40,9 @@ import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.ArraySet;
import android.util.IndentingPrintWriter;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.IndentingPrintWriter;
import com.android.internal.util.Preconditions;
import com.android.server.vcn.util.PersistableBundleUtils;

+4 −4
Original line number Diff line number Diff line
@@ -28,13 +28,13 @@ import android.content.Context;
import android.content.pm.PackageManager;
import android.net.LinkProperties;
import android.net.NetworkCapabilities;
import android.os.Binder;
import android.os.ParcelUuid;
import android.os.RemoteException;
import android.os.ServiceSpecificException;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting.Visibility;
import com.android.net.module.util.BinderUtils;

import java.io.IOException;
import java.lang.annotation.Retention;
@@ -711,7 +711,7 @@ public class VcnManager {

        @Override
        public void onPolicyChanged() {
            Binder.withCleanCallingIdentity(
            BinderUtils.withCleanCallingIdentity(
                    () -> mExecutor.execute(() -> mListener.onPolicyChanged()));
        }
    }
@@ -734,7 +734,7 @@ public class VcnManager {

        @Override
        public void onVcnStatusChanged(@VcnStatusCode int statusCode) {
            Binder.withCleanCallingIdentity(
            BinderUtils.withCleanCallingIdentity(
                    () -> mExecutor.execute(() -> mCallback.onStatusChanged(statusCode)));
        }

@@ -747,7 +747,7 @@ public class VcnManager {
                @Nullable String exceptionMessage) {
            final Throwable cause = createThrowableByClassName(exceptionClass, exceptionMessage);

            Binder.withCleanCallingIdentity(
            BinderUtils.withCleanCallingIdentity(
                    () ->
                            mExecutor.execute(
                                    () ->
+1 −1
Original line number Diff line number Diff line
@@ -21,10 +21,10 @@ import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.PersistableBundle;
import android.util.IndentingPrintWriter;
import android.util.SparseArray;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.IndentingPrintWriter;
import com.android.internal.util.Preconditions;

import java.lang.annotation.Retention;
+1 −1
Original line number Diff line number Diff line
@@ -29,9 +29,9 @@ import android.net.NetworkCapabilities;
import android.net.vcn.VcnUnderlyingNetworkTemplate.MatchCriteria;
import android.os.PersistableBundle;
import android.util.ArraySet;
import android.util.IndentingPrintWriter;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.IndentingPrintWriter;
import com.android.server.vcn.util.PersistableBundleUtils;

import java.util.ArrayList;
+12 −11
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.IndentingPrintWriter;
import android.util.LocalLog;
import android.util.Log;
import android.util.Slog;
@@ -82,7 +83,7 @@ import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting.Visibility;
import com.android.internal.util.IndentingPrintWriter;
import com.android.net.module.util.BinderUtils;
import com.android.net.module.util.LocationPermissionChecker;
import com.android.net.module.util.PermissionUtils;
import com.android.server.vcn.TelephonySubscriptionTracker;
@@ -448,7 +449,7 @@ public class VcnManagementService extends IVcnManagementService.Stub {
        final UserHandle userHandle = UserHandle.getUserHandleForUid(uid);
        final UserManager userManager = mContext.getSystemService(UserManager.class);

        Binder.withCleanCallingIdentity(
        BinderUtils.withCleanCallingIdentity(
                () -> {
                    if (!Objects.equals(userManager.getMainUser(), userHandle)) {
                        throw new SecurityException(
@@ -468,7 +469,7 @@ public class VcnManagementService extends IVcnManagementService.Stub {
        // TODO (b/172619301): Check based on events propagated from CarrierPrivilegesTracker
        final SubscriptionManager subMgr = mContext.getSystemService(SubscriptionManager.class);
        final List<SubscriptionInfo> subscriptionInfos = new ArrayList<>();
        Binder.withCleanCallingIdentity(
        BinderUtils.withCleanCallingIdentity(
                () -> {
                    List<SubscriptionInfo> subsInGroup =
                            subMgr.getSubscriptionsInGroup(subscriptionGroup);
@@ -700,7 +701,7 @@ public class VcnManagementService extends IVcnManagementService.Stub {
    @GuardedBy("mLock")
    private void notifyAllPolicyListenersLocked() {
        for (final PolicyListenerBinderDeath policyListener : mRegisteredPolicyListeners.values()) {
            Binder.withCleanCallingIdentity(() -> {
            BinderUtils.withCleanCallingIdentity(() -> {
                try {
                    policyListener.mListener.onPolicyChanged();
                } catch (RemoteException e) {
@@ -715,7 +716,7 @@ public class VcnManagementService extends IVcnManagementService.Stub {
            @NonNull ParcelUuid subGroup, @VcnStatusCode int statusCode) {
        for (final VcnStatusCallbackInfo cbInfo : mRegisteredStatusCallbacks.values()) {
            if (isCallbackPermissioned(cbInfo, subGroup)) {
                Binder.withCleanCallingIdentity(() -> {
                BinderUtils.withCleanCallingIdentity(() -> {
                    try {
                        cbInfo.mCallback.onVcnStatusChanged(statusCode);
                    } catch (RemoteException e) {
@@ -795,7 +796,7 @@ public class VcnManagementService extends IVcnManagementService.Stub {
        enforceManageTestNetworksForTestMode(config);
        enforceCallingUserAndCarrierPrivilege(subscriptionGroup, opPkgName);

        Binder.withCleanCallingIdentity(() -> {
        BinderUtils.withCleanCallingIdentity(() -> {
            synchronized (mLock) {
                mConfigs.put(subscriptionGroup, config);
                startOrUpdateVcnLocked(subscriptionGroup, config);
@@ -853,7 +854,7 @@ public class VcnManagementService extends IVcnManagementService.Stub {
                .checkPackage(mDeps.getBinderCallingUid(), opPkgName);
        enforceCarrierPrivilegeOrProvisioningPackage(subscriptionGroup, opPkgName);

        Binder.withCleanCallingIdentity(() -> {
        BinderUtils.withCleanCallingIdentity(() -> {
            synchronized (mLock) {
                stopAndClearVcnConfigInternalLocked(subscriptionGroup);
                writeConfigsToDiskLocked();
@@ -991,7 +992,7 @@ public class VcnManagementService extends IVcnManagementService.Stub {
                android.Manifest.permission.NETWORK_FACTORY,
                android.Manifest.permission.MANAGE_TEST_NETWORKS);

        Binder.withCleanCallingIdentity(() -> {
        BinderUtils.withCleanCallingIdentity(() -> {
            PolicyListenerBinderDeath listenerBinderDeath = new PolicyListenerBinderDeath(listener);

            synchronized (mLock) {
@@ -1018,7 +1019,7 @@ public class VcnManagementService extends IVcnManagementService.Stub {
                android.Manifest.permission.NETWORK_FACTORY,
                android.Manifest.permission.MANAGE_TEST_NETWORKS);

        Binder.withCleanCallingIdentity(() -> {
        BinderUtils.withCleanCallingIdentity(() -> {
            synchronized (mLock) {
                PolicyListenerBinderDeath listenerBinderDeath =
                        mRegisteredPolicyListeners.remove(listener.asBinder());
@@ -1082,7 +1083,7 @@ public class VcnManagementService extends IVcnManagementService.Stub {
                            + " MANAGE_TEST_NETWORKS");
        }

        return Binder.withCleanCallingIdentity(() -> {
        return BinderUtils.withCleanCallingIdentity(() -> {
            // Defensive copy in case this call is in-process and the given NetworkCapabilities
            // mutates
            final NetworkCapabilities ncCopy = new NetworkCapabilities(networkCapabilities);
@@ -1521,7 +1522,7 @@ public class VcnManagementService extends IVcnManagementService.Stub {
                // Notify all registered StatusCallbacks for this subGroup
                for (VcnStatusCallbackInfo cbInfo : mRegisteredStatusCallbacks.values()) {
                    if (isCallbackPermissioned(cbInfo, mSubGroup)) {
                        Binder.withCleanCallingIdentity(() -> {
                        BinderUtils.withCleanCallingIdentity(() -> {
                            try {
                                cbInfo.mCallback.onGatewayConnectionError(
                                        gatewayConnectionName,
Loading