Show "Backup service isn't active" if backup isnt active for work
profile

Bug: 127821779

Test: 1) Set up work profile.
2) adb shell bmgr --user 19 activate true
3) Settings -> System -> Backup -> Work -> Shows google backup settings
4) adb shell bmgr --user 19 activate false
5) Settings -> System -> Backup -> Work -> "Backup service isn't active"

Change-Id: Ifc16cf3e69fd9db87d519cbad68f0f8e9d8ef6f3
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 001e65b..e704076 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -632,10 +632,14 @@
                 showDev, isAdmin)
                 || somethingChanged;
 
-        // Enable/disable backup settings depending on whether backup is activated for the user.
-        boolean isBackupActive = new BackupSettingsHelper(this).isBackupServiceActive();
+        // For profiles, we want them to be included in the profile select dialog even if
+        // backup is not activated.
+        // For other users, enable/disable backup settings depending on whether backup is activated
+        // for the user.
+        boolean enableBackupTile = um.isManagedProfile()
+                || new BackupSettingsHelper(this).isBackupServiceActive();
         somethingChanged = setTileEnabled(changedList, new ComponentName(packageName,
-                UserBackupSettingsActivity.class.getName()), isBackupActive, isAdmin)
+                UserBackupSettingsActivity.class.getName()), enableBackupTile, isAdmin)
                 || somethingChanged;
 
         somethingChanged = setTileEnabled(changedList, new ComponentName(packageName,
diff --git a/src/com/android/settings/backup/BackupInactivePreferenceController.java b/src/com/android/settings/backup/BackupInactivePreferenceController.java
index 8bd278c..83a0318 100644
--- a/src/com/android/settings/backup/BackupInactivePreferenceController.java
+++ b/src/com/android/settings/backup/BackupInactivePreferenceController.java
@@ -28,9 +28,6 @@
 
     @Override
     public int getAvailabilityStatus() {
-        if (!PrivacySettingsUtils.isAdminUser(mContext)) {
-            return DISABLED_FOR_USER;
-        }
         if (PrivacySettingsUtils.isInvisibleKey(mContext, PrivacySettingsUtils.BACKUP_INACTIVE)) {
             return UNSUPPORTED_ON_DEVICE;
         }