OSDN Git Service

Only try disabling quiet mode
authorBenjamin Franz <bfranz@google.com>
Tue, 5 Apr 2016 13:37:17 +0000 (14:37 +0100)
committerBenjamin Franz <bfranz@google.com>
Wed, 13 Apr 2016 18:14:37 +0000 (19:14 +0100)
The underlying API has slightly changed to require the profile
challenge if the profile that we're trying to enable hasn't been
unlocked yet.

Bug: 27764124
Change-Id: I9efb3d3ed49034b573abb4c18119ffadcccfe947

src/com/android/settings/accounts/AccountSettings.java
src/com/android/settings/dashboard/conditional/WorkModeCondition.java

index 927ad23..852d33a 100644 (file)
@@ -251,7 +251,11 @@ public class AccountSettings extends SettingsPreferenceFragment
             ProfileData profileData = mProfiles.valueAt(i);
             if (preference == profileData.workModeSwitch) {
                 final int userId = profileData.userInfo.id;
-                mUm.setQuietModeEnabled(userId, !((boolean) newValue));
+                if ((boolean) newValue) {
+                    mUm.trySetQuietModeDisabled(userId, null);
+                } else {
+                    mUm.setQuietModeEnabled(userId, true);
+                }
                 return true;
             }
         }
index f46b495..3d9958b 100644 (file)
@@ -90,7 +90,7 @@ public class WorkModeCondition extends Condition {
     @Override
     public void onActionClick(int index) {
         if (index == 0) {
-            mUm.setQuietModeEnabled(mUserHandle.getIdentifier(), false);
+            mUm.trySetQuietModeDisabled(mUserHandle.getIdentifier(), null);
             setActive(false);
         } else {
             throw new IllegalArgumentException("Unexpected index " + index);