From e2d2f4488803050594598282d04489fa0d2fd6d0 Mon Sep 17 00:00:00 2001 From: alinasuarez Date: Wed, 4 Aug 2021 20:39:09 +0000 Subject: [PATCH] Revert to Default Settings Add functionality to the revert default settings button. This currently writes a null value to the ENABLE_TARE constant. In the future this will also make the AlarmManager and JobScheduler constants null so that the default values are used instead of custom config values. Bug: 195543827 Test: Click on revert to default settings button, check that the value for ENABLE_TARE is null by running "adb shell settings get global enable_tare" in the command line Change-Id: I558e8f1121021eca3224e4bc9b26bbe0dd2467c7 --- src/com/android/settings/development/tare/TareHomePage.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/android/settings/development/tare/TareHomePage.java b/src/com/android/settings/development/tare/TareHomePage.java index 12e8427f120..8aa77e3270a 100644 --- a/src/com/android/settings/development/tare/TareHomePage.java +++ b/src/com/android/settings/development/tare/TareHomePage.java @@ -23,6 +23,7 @@ import static com.android.settings.development.tare.DropdownActivity.POLICY_JOB_ import android.app.Activity; import android.content.Intent; import android.os.Bundle; +import android.provider.Settings; import android.view.View; import android.widget.Button; import android.widget.CompoundButton; @@ -66,6 +67,8 @@ public class TareHomePage extends Activity { // TODO: Establish default TARE values and make this method revert all settings back to default. public void revertSettings(View v) { Toast.makeText(this, R.string.tare_settings_reverted_toast, Toast.LENGTH_LONG).show(); + Settings.Global.putString(getApplicationContext().getContentResolver(), + Settings.Global.ENABLE_TARE, null); } /** Opens up the AlarmManager TARE policy page with its factors to view and edit */