[automerge] Unchecked battery saver switch once it's 1st launch 2p: d2ce1d9194

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/17707388

Bug: 227725656
Change-Id: If2036f7792f3c9358e88061d5afd4873612fd3f9
This commit is contained in:
Presubmit Automerger Backend
2022-04-13 09:07:40 +00:00
2 changed files with 33 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.PowerManager;
import android.provider.Settings;
import android.provider.SettingsSlicesContract;
import android.widget.Switch;
@@ -101,6 +102,11 @@ public class BatterySaverButtonPreferenceController extends
@Override
public void onSwitchChanged(Switch switchView, boolean isChecked) {
// Cancel preference's check state once it's first time launch
if (isChecked && (Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.LOW_POWER_WARNING_ACKNOWLEDGED, 0) == 0)) {
mPreference.setChecked(false);
}
setChecked(isChecked);
}