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

Commit 4d626f63 authored by Chandan Nath's avatar Chandan Nath
Browse files

[Multi-user] Show Backup only if Backup is activated

This almost reverts the change to SettingsActivity#doUpdateTilesList in ag/6140694
except that instead of setting enabled to true, we set it to whether
backup is activated for this user.

Bug: 124114084

Test: 1a) Set up secondary user
1b) See that there is no Backup option in Settings Homepage - System
1c) adb shell bmgr --user 10 activate true
1d) Backup option is now present
1e) adb shell bmgr --user 10 activate false
1f) Backup option isnt there again

Change-Id: I3f17aabee92bedc91386444c2f0aede696d0fd13
parent ece6d94b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -50,6 +50,8 @@ import androidx.preference.PreferenceManager;
import com.android.internal.util.ArrayUtils;
import com.android.settings.Settings.WifiSettingsActivity;
import com.android.settings.applications.manageapplications.ManageApplications;
import com.android.settings.backup.BackupSettingsHelper;
import com.android.settings.backup.UserBackupSettingsActivity;
import com.android.settings.core.OnActivityResultListener;
import com.android.settings.core.SettingsBaseActivity;
import com.android.settings.core.SubSettingLauncher;
@@ -630,6 +632,12 @@ public class SettingsActivity extends SettingsBaseActivity
                showDev, isAdmin)
                || somethingChanged;

        // Enable/disable backup settings depending on whether backup is activated for the user.
        boolean isBackupActive = new BackupSettingsHelper(this).isBackupServiceActive();
        somethingChanged = setTileEnabled(changedList, new ComponentName(packageName,
                UserBackupSettingsActivity.class.getName()), isBackupActive, isAdmin)
                || somethingChanged;

        somethingChanged = setTileEnabled(changedList, new ComponentName(packageName,
                        Settings.WifiDisplaySettingsActivity.class.getName()),
                WifiDisplaySettings.isAvailable(this), isAdmin)
+1 −1
Original line number Diff line number Diff line
@@ -209,7 +209,7 @@ public class BackupSettingsHelper {
    }

    /** Checks if backup service is enabled for this user. */
    private boolean isBackupServiceActive() {
    public boolean isBackupServiceActive() {
        boolean backupOkay;
        try {
            backupOkay = mBackupManager.isBackupServiceActive(UserHandle.myUserId());