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

Commit 559735e0 authored by Hani Kazmi's avatar Hani Kazmi
Browse files

[AAPM] Remove unreleased WEP feature.

This feature was developed for Android B but never released. This change
removes UI related code for the feature, and references to the AAPM
flag.

Bug: 433316458
Bug: 352420507
Test: atest AdvancedProtectionServiceTest SettingsLibWifiUtilsTest
InternetAdapterTest ActionDisabledByAdvancedProtectionDialogTest
WepNetworksPreferenceControllerTest SpaUnitTests
Flag: EXEMPT FLAG_REMOVAL

Change-Id: I07ffcc28c80589357beee22a17355e5e674ebf7e
parent d4782543
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import android.annotation.SystemService;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.Intent;
import android.net.wifi.WifiManager;
import android.os.Binder;
import android.os.RemoteException;
import android.os.UserManager;
@@ -98,7 +97,6 @@ public final class AdvancedProtectionManager {
     * Feature identifier for disallowing connections to Wi-Fi Wired Equivalent Privacy (WEP)
     * networks.
     *
     * @see WifiManager#isWepSupported()
     * @hide */
    @SystemApi
    public static final int FEATURE_ID_DISALLOW_WEP = 3;
@@ -118,7 +116,6 @@ public final class AdvancedProtectionManager {
            FEATURE_ID_DISALLOW_CELLULAR_2G,
            FEATURE_ID_DISALLOW_INSTALL_UNKNOWN_SOURCES,
            FEATURE_ID_DISALLOW_USB,
            FEATURE_ID_DISALLOW_WEP,
            FEATURE_ID_ENABLE_MTE,
    })
    @Retention(RetentionPolicy.SOURCE)
@@ -130,7 +127,6 @@ public final class AdvancedProtectionManager {
            case FEATURE_ID_DISALLOW_CELLULAR_2G -> "DISALLOW_CELLULAR_2G";
            case FEATURE_ID_DISALLOW_INSTALL_UNKNOWN_SOURCES -> "DISALLOW_INSTALL_UNKNOWN_SOURCES";
            case FEATURE_ID_DISALLOW_USB -> "DISALLOW_USB";
            case FEATURE_ID_DISALLOW_WEP -> "DISALLOW_WEP";
            case FEATURE_ID_ENABLE_MTE -> "ENABLE_MTE";
            default -> "UNKNOWN";
        };
@@ -140,7 +136,6 @@ public final class AdvancedProtectionManager {
            FEATURE_ID_DISALLOW_CELLULAR_2G,
            FEATURE_ID_DISALLOW_INSTALL_UNKNOWN_SOURCES,
            FEATURE_ID_DISALLOW_USB,
            FEATURE_ID_DISALLOW_WEP,
            FEATURE_ID_ENABLE_MTE);

    /**
+1 −22
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import android.net.wifi.WifiManager
import android.net.wifi.sharedconnectivity.app.NetworkProviderInfo
import android.os.Bundle
import android.os.SystemClock
import android.security.advancedprotection.AdvancedProtectionManager
import android.util.Log
import android.view.WindowManager
import androidx.annotation.VisibleForTesting
@@ -501,18 +500,10 @@ open class WifiUtils {
            dialogWindowType: Int,
            onStartActivity: (intent: Intent) -> Unit,
            onAllowed: () -> Unit,
            onStartAapmActivity: (intent: Intent) -> Unit = onStartActivity,
        ): Job =
            coroutineScope.launch {
                val wifiManager = context.getSystemService(WifiManager::class.java) ?: return@launch
                val aapmManager = context.getSystemService(AdvancedProtectionManager::class.java)
                if (isAdvancedProtectionEnabled(aapmManager)) {
                    val intent = AdvancedProtectionManager.createSupportIntent(
                        AdvancedProtectionManager.FEATURE_ID_DISALLOW_WEP,
                        AdvancedProtectionManager.SUPPORT_DIALOG_TYPE_BLOCKED_INTERACTION)
                    intent.putExtra(DIALOG_WINDOW_TYPE, dialogWindowType)
                    withContext(Dispatchers.Main) { onStartAapmActivity(intent) }
                } else if (wifiManager.isWepSupported == true && wifiManager.queryWepAllowed()) {
                if (wifiManager.isWepSupported == true && wifiManager.queryWepAllowed()) {
                    withContext(Dispatchers.Main) { onAllowed() }
                } else {
                    val intent = Intent(Intent.ACTION_MAIN).apply {
@@ -536,18 +527,6 @@ open class WifiUtils {
                }
            }

        private suspend fun isAdvancedProtectionEnabled(
            aapmManager: AdvancedProtectionManager?
        ): Boolean =
            if (android.security.Flags.aapmApi() &&
                    com.android.wifi.flags.Flags.wepDisabledInApm() &&
                    aapmManager != null
            ) {
                withContext(Dispatchers.Default) { aapmManager.isAdvancedProtectionEnabled() }
            } else {
                false
            }

        const val SSID = "ssid"
        const val DIALOG_WINDOW_TYPE = "dialog_window_type"
    }
+0 −4
Original line number Diff line number Diff line
@@ -250,10 +250,6 @@ public class InternetAdapter extends RecyclerView.Adapter<InternetAdapter.Intern
                            }, () -> {
                                wifiConnect(wifiEntry, view);
                                return null;
                            }, intent -> {
                                mInternetDetailsContentController
                                        .startActivityForDialogDismissDialogFirst(intent, view);
                                return null;
                            });
                }
                return;
+0 −11
Original line number Diff line number Diff line
@@ -875,17 +875,6 @@ public class InternetDetailsContentController implements AccessPointController.A
        mActivityStarter.startActivity(intent, false /* dismissShade */);
    }

    // Closes the dialog first, as the WEP dialog is in a different process and can have weird
    // interactions otherwise.
    void startActivityForDialogDismissDialogFirst(Intent intent, View view) {
        ActivityTransitionAnimator.Controller controller =
                mDialogTransitionAnimator.createActivityTransitionController(view);
        if (mCallback != null) {
            mCallback.dismissDialog();
        }
        mActivityStarter.startActivity(intent, false /* dismissShade */, controller);
    }

    void launchNetworkSetting(View view) {
        startActivity(getSettingsIntent(), view);
    }
+0 −5
Original line number Diff line number Diff line
@@ -64,7 +64,6 @@ import com.android.server.security.advancedprotection.features.AdvancedProtectio
import com.android.server.security.advancedprotection.features.AdvancedProtectionProvider;
import com.android.server.security.advancedprotection.features.DisallowCellular2GAdvancedProtectionHook;
import com.android.server.security.advancedprotection.features.DisallowInstallUnknownSourcesAdvancedProtectionHook;
import com.android.server.security.advancedprotection.features.DisallowWepAdvancedProtectionProvider;
import com.android.server.security.advancedprotection.features.MemoryTaggingExtensionHook;
import com.android.server.security.advancedprotection.features.UsbDataAdvancedProtectionHook;

@@ -143,8 +142,6 @@ public class AdvancedProtectionService extends IAdvancedProtectionService.Stub {
            Slog.e(TAG, "Failed to initialize UsbDataAdvancedProtection", e);
          }
        }

        mProviders.add(new DisallowWepAdvancedProtectionProvider());
    }

    private void initLogging() {
@@ -303,8 +300,6 @@ public class AdvancedProtectionService extends IAdvancedProtectionService.Stub {
                return AdvancedProtectionProtoEnums.FEATURE_ID_DISALLOW_INSTALL_UNKNOWN_SOURCES;
            case AdvancedProtectionManager.FEATURE_ID_DISALLOW_USB:
                return AdvancedProtectionProtoEnums.FEATURE_ID_DISALLOW_USB;
            case AdvancedProtectionManager.FEATURE_ID_DISALLOW_WEP:
                return AdvancedProtectionProtoEnums.FEATURE_ID_DISALLOW_WEP;
            case AdvancedProtectionManager.FEATURE_ID_ENABLE_MTE:
                return AdvancedProtectionProtoEnums.FEATURE_ID_ENABLE_MTE;
            default:
Loading