Loading AndroidManifest.xml +4 −0 Original line number Diff line number Diff line Loading @@ -1485,6 +1485,10 @@ android:value="true" /> </activity> <activity android:name=".development.tare.TareHomePage" android:label="@string/tare_settings" android:exported="false" /> <activity android:name="SetFullBackupPassword" android:label="@string/local_backup_password_title" android:exported="false" /> Loading res/layout/tare_homepage.xml 0 → 100644 +63 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2021 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".development.tare.TareHomePage"> <Switch android:id="@+id/on_switch" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="20dp" android:text="On" android:background="?android:attr/colorBackground"/> <TextView android:id="@+id/alarm_manager" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="20dp" android:clickable="true" android:text="@string/tare_alarm_manager" android:textColor="?android:attr/textColorSecondary"/> <TextView android:id="@+id/job_scheduler" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="20dp" android:clickable="true" android:text="@string/tare_job_scheduler" android:textColor="?android:attr/textColorSecondary"/> <View android:id="@+id/divider" android:layout_width="match_parent" android:layout_height="1dp" android:background="?android:attr/listDivider" /> <Button android:id="@+id/revert_button" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="20dp" android:onClick="revertSettings" android:text="@string/tare_revert"/> </LinearLayout> res/values/strings.xml +13 −0 Original line number Diff line number Diff line Loading @@ -13611,4 +13611,17 @@ <string name="bluetooth_connect_access_dialog_negative">Don\u2019t connect</string> <!-- Strings for Dialog connect button --> <string name="bluetooth_connect_access_dialog_positive">Connect</string> <!-- Title for the button to edit The Android Resource Economy settings. [CHAR LIMIT=NONE] --> <string name="tare_title" translatable="false">TARE</string> <!-- TARE settings title in developer options; TARE" is not translatable but "settings" is [CHAR LIMIT=40] --> <string name="tare_settings">TARE Settings</string> <!-- Allows user to revert the TARE settings to their default values [CHAR LIMIT=40] --> <string name="tare_revert">Revert to Default Settings</string> <!-- Allows user to view Alarm Manager policy factors [CHAR LIMIT=40]--> <string name="tare_alarm_manager">Alarm Manager</string> <!-- Allows user to view Job Scheduler policy factors [CHAR LIMIT=40]--> <string name="tare_job_scheduler">Job Scheduler</string> <!-- Toast notifying the developer that settings were reverted to their default [CHAR LIMIT=40]--> <string name="tare_settings_reverted_toast">Settings reverted to default.</string> </resources> res/xml/development_settings.xml +8 −0 Original line number Diff line number Diff line Loading @@ -606,6 +606,14 @@ android:title="@string/inactive_apps_title" android:fragment="com.android.settings.fuelgauge.InactiveApps" /> <Preference android:key="tare" android:title="@string/tare_title" > <intent android:targetPackage="com.android.settings" android:targetClass="com.android.settings.development.tare.TareHomePage" /> </Preference> <SwitchPreference android:key="force_allow_on_external" android:title="@string/force_allow_on_external" Loading src/com/android/settings/development/tare/TareHomePage.java 0 → 100644 +65 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.development.tare; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.Switch; import android.widget.TextView; import android.widget.Toast; import com.android.settings.R; /** Class for creating the TARE homepage in settings*/ public class TareHomePage extends Activity { private Switch mOnSwitch; private Button mRevButton; private TextView mAlarmManagerView; private TextView mJobSchedulerView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tare_homepage); mOnSwitch = findViewById(R.id.on_switch); mRevButton = findViewById(R.id.revert_button); mAlarmManagerView = findViewById(R.id.alarm_manager); mJobSchedulerView = findViewById(R.id.job_scheduler); // TODO: Set the status of the buttons based on the current status mOnSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { mRevButton.setEnabled(isChecked); mAlarmManagerView.setEnabled(isChecked); mJobSchedulerView.setEnabled(isChecked); } }); } /** This method should revert the TARE settings to the original default settings */ // 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(); } } Loading
AndroidManifest.xml +4 −0 Original line number Diff line number Diff line Loading @@ -1485,6 +1485,10 @@ android:value="true" /> </activity> <activity android:name=".development.tare.TareHomePage" android:label="@string/tare_settings" android:exported="false" /> <activity android:name="SetFullBackupPassword" android:label="@string/local_backup_password_title" android:exported="false" /> Loading
res/layout/tare_homepage.xml 0 → 100644 +63 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2021 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".development.tare.TareHomePage"> <Switch android:id="@+id/on_switch" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="20dp" android:text="On" android:background="?android:attr/colorBackground"/> <TextView android:id="@+id/alarm_manager" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="20dp" android:clickable="true" android:text="@string/tare_alarm_manager" android:textColor="?android:attr/textColorSecondary"/> <TextView android:id="@+id/job_scheduler" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="20dp" android:clickable="true" android:text="@string/tare_job_scheduler" android:textColor="?android:attr/textColorSecondary"/> <View android:id="@+id/divider" android:layout_width="match_parent" android:layout_height="1dp" android:background="?android:attr/listDivider" /> <Button android:id="@+id/revert_button" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="20dp" android:onClick="revertSettings" android:text="@string/tare_revert"/> </LinearLayout>
res/values/strings.xml +13 −0 Original line number Diff line number Diff line Loading @@ -13611,4 +13611,17 @@ <string name="bluetooth_connect_access_dialog_negative">Don\u2019t connect</string> <!-- Strings for Dialog connect button --> <string name="bluetooth_connect_access_dialog_positive">Connect</string> <!-- Title for the button to edit The Android Resource Economy settings. [CHAR LIMIT=NONE] --> <string name="tare_title" translatable="false">TARE</string> <!-- TARE settings title in developer options; TARE" is not translatable but "settings" is [CHAR LIMIT=40] --> <string name="tare_settings">TARE Settings</string> <!-- Allows user to revert the TARE settings to their default values [CHAR LIMIT=40] --> <string name="tare_revert">Revert to Default Settings</string> <!-- Allows user to view Alarm Manager policy factors [CHAR LIMIT=40]--> <string name="tare_alarm_manager">Alarm Manager</string> <!-- Allows user to view Job Scheduler policy factors [CHAR LIMIT=40]--> <string name="tare_job_scheduler">Job Scheduler</string> <!-- Toast notifying the developer that settings were reverted to their default [CHAR LIMIT=40]--> <string name="tare_settings_reverted_toast">Settings reverted to default.</string> </resources>
res/xml/development_settings.xml +8 −0 Original line number Diff line number Diff line Loading @@ -606,6 +606,14 @@ android:title="@string/inactive_apps_title" android:fragment="com.android.settings.fuelgauge.InactiveApps" /> <Preference android:key="tare" android:title="@string/tare_title" > <intent android:targetPackage="com.android.settings" android:targetClass="com.android.settings.development.tare.TareHomePage" /> </Preference> <SwitchPreference android:key="force_allow_on_external" android:title="@string/force_allow_on_external" Loading
src/com/android/settings/development/tare/TareHomePage.java 0 → 100644 +65 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.development.tare; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.Switch; import android.widget.TextView; import android.widget.Toast; import com.android.settings.R; /** Class for creating the TARE homepage in settings*/ public class TareHomePage extends Activity { private Switch mOnSwitch; private Button mRevButton; private TextView mAlarmManagerView; private TextView mJobSchedulerView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tare_homepage); mOnSwitch = findViewById(R.id.on_switch); mRevButton = findViewById(R.id.revert_button); mAlarmManagerView = findViewById(R.id.alarm_manager); mJobSchedulerView = findViewById(R.id.job_scheduler); // TODO: Set the status of the buttons based on the current status mOnSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { mRevButton.setEnabled(isChecked); mAlarmManagerView.setEnabled(isChecked); mJobSchedulerView.setEnabled(isChecked); } }); } /** This method should revert the TARE settings to the original default settings */ // 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(); } }