Merge "Guard against duplicate calls to setQuietModeEnabled" into main
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.accounts;
|
||||
|
||||
import android.app.admin.flags.Flags;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -58,7 +59,14 @@ final class ManagedProfileQuietModeEnabler implements DefaultLifecycleObserver {
|
||||
}
|
||||
|
||||
public void setQuietModeEnabled(boolean enabled) {
|
||||
if (mManagedProfile != null) {
|
||||
if (mManagedProfile == null) {
|
||||
return;
|
||||
}
|
||||
if (Flags.quietModeCredentialBugFix()) {
|
||||
if (isQuietModeEnabled() != enabled) {
|
||||
mUserManager.requestQuietModeEnabled(enabled, mManagedProfile);
|
||||
}
|
||||
} else {
|
||||
mUserManager.requestQuietModeEnabled(enabled, mManagedProfile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,9 @@ public class WorkModePreferenceController extends BasePreferenceController
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
mQuietModeEnabler.setQuietModeEnabled(!isChecked);
|
||||
if (android.app.admin.flags.Flags.quietModeCredentialBugFix()) {
|
||||
updateState(mPreference);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user