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

Commit eef5065e authored by Ricky Wai's avatar Ricky Wai
Browse files

Change Network Watchlist feature flag

Bug: 63908748
Test: From log, feature is enabled/disabled when setting is enabled/disabled
Change-Id: Ifa41ea98b3ab27bdc6c06f07cb9766406427b3fc
parent b929041f
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -9749,6 +9749,14 @@ public final class Settings {
         */
        public static final java.lang.String APP_STANDBY_ENABLED = "app_standby_enabled";

        /**
         * Whether or not Network Watchlist feature is enabled.
         * Type: int (0 for false, 1 for true)
         * Default: 0
         * @hide
         */
        public static final String NETWORK_WATCHLIST_ENABLED = "network_watchlist_enabled";

        /**
         * Get the key that retrieves a bluetooth headset's priority.
         * @hide
+1 −0
Original line number Diff line number Diff line
@@ -280,6 +280,7 @@ public class SettingsBackupTest {
                    Settings.Global.NETWORK_SCORING_UI_ENABLED,
                    Settings.Global.NETWORK_SWITCH_NOTIFICATION_DAILY_LIMIT,
                    Settings.Global.NETWORK_SWITCH_NOTIFICATION_RATE_LIMIT_MILLIS,
                    Settings.Global.NETWORK_WATCHLIST_ENABLED,
                    Settings.Global.NEW_CONTACT_AGGREGATOR,
                    Settings.Global.NITZ_UPDATE_DIFF,
                    Settings.Global.NITZ_UPDATE_SPACING,
+10 −8
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.os.SharedMemory;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Slog;

@@ -52,9 +53,6 @@ public class NetworkWatchlistService extends INetworkWatchlistManager.Stub {
    private static final String TAG = NetworkWatchlistService.class.getSimpleName();
    static final boolean DEBUG = false;

    private static final String PROPERTY_NETWORK_WATCHLIST_ENABLED =
            "ro.network_watchlist_enabled";

    private static final int MAX_NUM_OF_WATCHLIST_DIGESTS = 10000;

    public static class Lifecycle extends SystemService {
@@ -66,8 +64,10 @@ public class NetworkWatchlistService extends INetworkWatchlistManager.Stub {

        @Override
        public void onStart() {
            if (!SystemProperties.getBoolean(PROPERTY_NETWORK_WATCHLIST_ENABLED, false)) {
            if (Settings.Global.getInt(getContext().getContentResolver(),
                    Settings.Global.NETWORK_WATCHLIST_ENABLED, 0) == 0) {
                // Watchlist service is disabled
                Slog.i(TAG, "Network Watchlist service is disabled");
                return;
            }
            mService = new NetworkWatchlistService(getContext());
@@ -76,11 +76,13 @@ public class NetworkWatchlistService extends INetworkWatchlistManager.Stub {

        @Override
        public void onBootPhase(int phase) {
            if (!SystemProperties.getBoolean(PROPERTY_NETWORK_WATCHLIST_ENABLED, false)) {
            if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) {
                if (Settings.Global.getInt(getContext().getContentResolver(),
                        Settings.Global.NETWORK_WATCHLIST_ENABLED, 0) == 0) {
                    // Watchlist service is disabled
                    Slog.i(TAG, "Network Watchlist service is disabled");
                    return;
                }
            if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) {
                try {
                    mService.initIpConnectivityMetrics();
                    mService.startWatchlistLogging();