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

Commit 3e418c53 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Softap: Let ap band changed notification to config changed."

parents a9677845 e5b9a556
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ android_test {
        "src/com/android/providers/settings/SettingsBackupAgent.java",
        "src/com/android/providers/settings/SettingsState.java",
        "src/com/android/providers/settings/SettingsHelper.java",
        "src/com/android/providers/settings/WifiSoftApBandChangedNotifier.java",
        "src/com/android/providers/settings/WifiSoftApConfigChangedNotifier.java",
    ],
    static_libs: [
        "androidx.test.rules",
+6 −10
Original line number Diff line number Diff line
@@ -968,18 +968,14 @@ public class SettingsBackupAgent extends BackupAgentHelper {
    }

    private void restoreSoftApConfiguration(byte[] data) {
        SoftApConfiguration config = mWifiManager.restoreSoftApBackupData(data);
        if (config != null) {
            int originalApBand = config.getBand();
        SoftApConfiguration configInCloud = mWifiManager.restoreSoftApBackupData(data);
        if (configInCloud != null) {
            if (DEBUG) Log.d(TAG, "Successfully unMarshaled SoftApConfiguration ");

            // Depending on device hardware, we may need to notify the user of a setting change for
            // the apBand preference
            boolean dualMode = mWifiManager.isDualModeSupported();
            int storedApBand = mWifiManager.getSoftApConfiguration().getBand();
            if (dualMode && storedApBand != originalApBand) {
            // Depending on device hardware, we may need to notify the user of a setting change
            SoftApConfiguration storedConfig = mWifiManager.getSoftApConfiguration();
            if (!storedConfig.equals(configInCloud)) {
                Log.d(TAG, "restored ap configuration requires a conversion, notify the user");
                WifiSoftApBandChangedNotifier.notifyUserOfApBandConversion(this);
                WifiSoftApConfigChangedNotifier.notifyUserOfConfigConversion(this);
            }
        }
    }
+5 −5
Original line number Diff line number Diff line
@@ -27,17 +27,17 @@ import com.android.internal.messages.nano.SystemMessageProto;
import com.android.internal.notification.SystemNotificationChannels;

/**
 * Helper class for sending notifications when the user's Soft AP Band was changed upon restore.
 * Helper class for sending notifications when the user's Soft AP config was changed upon restore.
 */
public class WifiSoftApBandChangedNotifier {
    private WifiSoftApBandChangedNotifier() {}
public class WifiSoftApConfigChangedNotifier {
    private WifiSoftApConfigChangedNotifier() {}

    /**
     * Send a notification informing the user that their' Soft AP Band was changed upon restore.
     * Send a notification informing the user that their' Soft AP Config was changed upon restore.
     * When the user taps on the notification, they are taken to the Wifi Tethering page in
     * Settings.
     */
    public static void notifyUserOfApBandConversion(Context context) {
    public static void notifyUserOfConfigConversion(Context context) {
        NotificationManager notificationManager =
                context.getSystemService(NotificationManager.class);