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

Commit 95d2add6 authored by Hugh Chen's avatar Hugh Chen Committed by Automerger Merge Worker
Browse files

RESTRICT AUTOMERGE Implement advanced vpn ui in vpn settings am: 858e6ff3

parents d39bc04b 858e6ff3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -617,4 +617,7 @@

    <!-- Whether to put the apps with system UID into system component bucket or not -->
    <bool name="config_battery_combine_system_components">false</bool>

    <!-- Whether to enable the advanced vpn feature. The default is not to. -->
    <bool name="config_advanced_vpn_enabled">false</bool>
</resources>
+5 −0
Original line number Diff line number Diff line
@@ -16,4 +16,9 @@

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
        android:title="@string/vpn_title">
    <PreferenceCategory
        android:key="advanced_vpn_group"/>

    <PreferenceCategory
        android:key="vpn_group"/>
</PreferenceScreen>
+6 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import com.android.settings.security.SecurityFeatureProvider;
import com.android.settings.security.SecuritySettingsFeatureProvider;
import com.android.settings.slices.SlicesFeatureProvider;
import com.android.settings.users.UserFeatureProvider;
import com.android.settings.vpn2.AdvancedVpnFeatureProvider;
import com.android.settings.wifi.WifiTrackerLibProvider;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;

@@ -177,6 +178,11 @@ public abstract class FeatureFactory {
     */
    public abstract AccessibilityMetricsFeatureProvider getAccessibilityMetricsFeatureProvider();

    /**
     * Retrieves implementation for advanced vpn feature.
     */
    public abstract AdvancedVpnFeatureProvider getAdvancedVpnFeatureProvider();

    public static final class FactoryNotFoundException extends RuntimeException {
        public FactoryNotFoundException(Throwable throwable) {
            super("Unable to create factory. Did you misconfigure Proguard?", throwable);
+11 −0
Original line number Diff line number Diff line
@@ -71,6 +71,8 @@ import com.android.settings.slices.SlicesFeatureProvider;
import com.android.settings.slices.SlicesFeatureProviderImpl;
import com.android.settings.users.UserFeatureProvider;
import com.android.settings.users.UserFeatureProviderImpl;
import com.android.settings.vpn2.AdvancedVpnFeatureProvider;
import com.android.settings.vpn2.AdvancedVpnFeatureProviderImpl;
import com.android.settings.wifi.WifiTrackerLibProvider;
import com.android.settings.wifi.WifiTrackerLibProviderImpl;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
@@ -106,6 +108,7 @@ public class FeatureFactoryImpl extends FeatureFactory {
    private SecuritySettingsFeatureProvider mSecuritySettingsFeatureProvider;
    private AccessibilitySearchFeatureProvider mAccessibilitySearchFeatureProvider;
    private AccessibilityMetricsFeatureProvider mAccessibilityMetricsFeatureProvider;
    private AdvancedVpnFeatureProvider mAdvancedVpnFeatureProvider;

    @Override
    public SupportFeatureProvider getSupportFeatureProvider(Context context) {
@@ -334,4 +337,12 @@ public class FeatureFactoryImpl extends FeatureFactory {
        }
        return mAccessibilityMetricsFeatureProvider;
    }

    @Override
    public AdvancedVpnFeatureProvider getAdvancedVpnFeatureProvider() {
        if (mAdvancedVpnFeatureProvider == null) {
            mAdvancedVpnFeatureProvider = new AdvancedVpnFeatureProviderImpl();
        }
        return mAdvancedVpnFeatureProvider;
    }
}
+45 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.settings.vpn2;

import android.content.Context;

/**
 * Feature Provider used in vpn usage
 */
public interface AdvancedVpnFeatureProvider {

    /**
     * Returns package name of advanced vpn.
     */
    String getAdvancedVpnPackageName();

    /**
     * Returns {@code true} advanced vpn is supported.
     */
    boolean isAdvancedVpnSupported(Context context);

    /**
     * Returns the title of advanced vpn preference group.
     */
    String getAdvancedVpnPreferenceGroupTitle(Context context);

    /**
     * Returns the title of vpn preference group.
     */
    String getVpnPreferenceGroupTitle(Context context);
}
Loading