Merge "Unchecked battery saver switch once it's 1st launch" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-04-13 11:15:46 +00:00
committed by Android (Google) Code Review
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);
}