Merge "Alarm Manager policy TARE page implementation"

This commit is contained in:
TreeHugger Robot
2021-08-02 19:37:17 +00:00
committed by Android (Google) Code Review
9 changed files with 435 additions and 12 deletions

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/factor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:paddingLeft="35dp" />
<TextView
android:id="@+id/factor_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body1"
android:paddingLeft="35dp" />
</LinearLayout>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
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.DropdownActivity">
<com.android.settingslib.widget.settingsspinner.SettingsSpinner
android:id="@+id/spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:theme="@style/Widget.PopupWindow.Settings"
android:padding="10dp" />
<FrameLayout
android:id="@+id/frame_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/spinner"
app:layout_constraintVertical_bias="0" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -18,7 +18,6 @@
<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"
@@ -29,15 +28,16 @@
android:layout_height="wrap_content"
android:padding="20dp"
android:text="On"
android:background="?android:attr/colorBackground"/>
android:background="?android:attr/colorBackground" />
<TextView
android:id="@+id/alarmmanager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="20dp"
android:clickable="true"
android:onClick="launchAlarmManagerPage"
android:text="@string/tare_alarmmanager"
android:textColor="?android:attr/textColorSecondary"/>
android:textColor="?android:attr/textColorSecondary" />
<TextView
android:id="@+id/jobscheduler"
@@ -46,7 +46,7 @@
android:padding="20dp"
android:clickable="true"
android:text="@string/tare_jobscheduler"
android:textColor="?android:attr/textColorSecondary"/>
android:textColor="?android:attr/textColorSecondary" />
<View
android:id="@+id/divider"
@@ -59,5 +59,5 @@
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:onClick="revertSettings"
android:text="@string/tare_revert"/>
</LinearLayout>
android:text="@string/tare_revert" />
</LinearLayout>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<ExpandableListView
android:id="@+id/factor_list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

View File

@@ -13618,7 +13618,7 @@
translated. "TARE" is not translatable. [CHAR LIMIT=NONE] -->
<string name="tare_title" translatable="false">TARE</string>
<!-- TARE settings title in developer options; "TARE" is the name of the feature and cannot be
translated. [CHAR LIMIT=40] -->
translated. [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>
@@ -13629,7 +13629,125 @@
<!-- Allows user to view JobScheduler policy factors. JobScheduler is the name of an Android
system service and cannot be translated.[CHAR LIMIT=40]-->
<string name="tare_jobscheduler" translatable="false">JobScheduler</string>
<!-- Toast notifying the developer that settings were reverted to their
default [CHAR LIMIT=40]-->
<!-- Toast notifying the developer that settings were reverted to their default values in
TARE [CHAR LIMIT=40]-->
<string name="tare_settings_reverted_toast">Settings reverted to default.</string>
<!-- Title for the TARE policy factor that determines the maximum credits an app can have in one
battery life cycle. Satiated means battery is fully charged; If this is not easily translatable,
translate "maximum balance when device is fully charged" instead. [CHAR LIMIT=40]-->
<string name="tare_max_satiated_balance">Maximum Satiated Balance</string>
<!-- Title for the TARE policy factor that determines the maximum credits in circulation between
all the apps [CHAR LIMIT=40]-->
<string name="tare_max_circulation">Maximum Circulation</string>
<!-- Title for the TARE policy factor that determines the minimum credits an app can have in one
battery life cycle. Satiated means battery is fully charged; If this is not easily translatable,
translate "minimum balance when device is fully charged" instead. [CHAR LIMIT=40]-->
<string name="tare_min_satiated_balance">Minimum Satiated Balance</string>
<!-- Title for the various modifiers that alter the cost of TARE tasks based on battery status
(charging, power save mode, etc.) [CHAR LIMIT=40]-->
<string name="tare_modifiers">Modifiers</string>
<!-- Title for the various TARE policy's action's cost to produce and price paid by
apps [CHAR LIMIT=40]-->
<string name="tare_actions">Actions</string>
<!-- Title for the instant, ongoing, and max rewards apps can obtain for different actions that
benefit the user. [CHAR LIMIT=40]-->
<string name="tare_rewards">Rewards</string>
<!-- Title for the Allow While Idle Exact Wakeup Alarm set via
AlarmManager.setExactAndAllowWhileIdle() [CHAR LIMIT=40]-->
<string name="tare_wakeup_exact_idle" translatable="false">
Allow While Idle Exact Wakeup Alarm</string>
<!-- Title for the Allow While Idle Inexact Wakeup Alarm set via
AlarmManager.setAndAllowWhileIdle() [CHAR LIMIT=40]-->
<string name="tare_wakeup_inexact_idle" translatable="false">
Allow While Idle Inexact Wakeup Alarm</string>
<!-- Title for the Exact Wakeup Alarm set via AlarmManager.setExact() [CHAR LIMIT=40]-->
<string name="tare_wakeup_exact" translatable="false">Exact Wakeup Alarm</string>
<!-- Title for the Inexact Wakeup Alarm set via AlarmManager.set() [CHAR LIMIT=40]-->
<string name="tare_wakeup_inexact" translatable="false">Inexact Wakeup Alarm</string>
<!-- Title for the Allow While Idle Exact NonWakeup Alarm set via
AlarmManager.setExactAndAllowWhileIdle() [CHAR LIMIT=40]-->
<string name="tare_nonwakeup_exact_idle" translatable="false">
Allow While Idle Exact NonWakeup Alarm</string>
<!-- Title for the Exact NonWakeup Alarm set via AlarmManager.setExact() [CHAR LIMIT=40]-->
<string name="tare_nonwakeup_exact" translatable="false">Exact NonWakeup Alarm</string>
<!-- Title for the Allow While Idle Inexact NonWakeup Alarm set via
AlarmManager.setAndAllowWhileIdle() [CHAR LIMIT=40]-->
<string name="tare_nonwakeup_inexact_idle" translatable="false">
Allow While Idle Inexact NonWakeup Alarm</string>
<!-- Title for the Inexact NonWakeup Alarm set via AlarmManager.set() [CHAR LIMIT=40]-->
<string name="tare_nonwakeup_inexact" translatable="false">Inexact NonWakeup Alarm</string>
<!-- Title for the AlarmClock alarm set via AlarmManager.setAlarmClock() [CHAR LIMIT=40]-->
<string name="tare_alarm_clock" translatable="false">AlarmClock</string>
<!-- Exempted apps are those apps exempted from most power saving features. [CHAR LIMIT=40]-->
<string name="tare_exempted">Exempted</string>
<!-- A headless system app is a preinstalled app that does not have any activities/UI that the
user can interact with. [CHAR LIMIT=40]-->
<string name="tare_headless_app">Headless System App</string>
<!-- Other apps are those apps interacted with by users that are not exempted or headless
system apps. [CHAR LIMIT=40]-->
<string name="tare_other_app">Other App</string>
<!-- Top activity means an app is in the TOP android process state and is thus visible to the
user[CHAR LIMIT=40]-->
<string name="tare_top_activity">Top Activity</string>
<!-- An event type denoting that a notification was viewed by the user, as defined in
UsageEvents.java [CHAR LIMIT=40]-->
<string name="tare_notification_seen">Notification Seen</string>
<!-- An event type denoting that a notification was viewed by the user within 15 minutes
[CHAR LIMIT=40]-->
<string name="tare_notification_seen_15_min">Notification Seen Within 15 Minutes</string>
<!-- An event type denoting that a notification was interacted with in some way by the user
[CHAR LIMIT=40]-->
<string name="tare_notification_interaction">Notification Interaction</string>
<!-- An event type denoting that an app's widget was interacted with in some way by the user
[CHAR LIMIT=40]-->
<string name="tare_widget_interaction">Widget Interaction</string>
<!-- An event type denoting that an app was interacted with in some way by the user
[CHAR LIMIT=40]-->
<string name="tare_other_interaction">Other User Interaction</string>
<!-- Titles for the minimum satiated credit balances for different types of apps
(per battery cycle). Satiated means battery is fully charged. [CHAR LIMIT=40]-->
<string-array name="tare_min_satiated_balance_subfactors" translatable="false">
<item>@string/tare_exempted</item>
<item>@string/tare_headless_app</item>
<item>@string/tare_other_app</item>
</string-array>
<!-- Various modifier subfactors that alter the cost of TARE tasks depending on what battery
state the device is in [CHAR LIMIT=40]-->
<string-array name="tare_modifiers_subfactors">
<item>Charging</item>
<!-- Doze refers to the Android Doze feature -->
<item>Doze</item>
<item>Power Save Mode</item>
<!-- An app's process state is the internal level of an app's process inside the system -->
<item>Process State</item>
</string-array>
<!-- Various AlarmManager alarms with different costs to produce and price paid by apps
if they want to produce these alarms. Alarm in this context refers to the possible alarm cases
in AlarmManager. [CHAR LIMIT=40]-->
<string-array name="tare_actions_subfactors" translatable="false">
<item>@string/tare_wakeup_exact_idle</item>
<item>@string/tare_wakeup_inexact_idle</item>
<item>@string/tare_wakeup_exact</item>
<item>@string/tare_wakeup_inexact</item>
<item>@string/tare_nonwakeup_exact_idle</item>
<item>@string/tare_nonwakeup_exact</item>
<item>@string/tare_nonwakeup_inexact_idle</item>
<item>@string/tare_nonwakeup_inexact</item>
<item>@string/tare_alarm_clock</item>
</string-array>
<!-- Titles for the different rewards apps could obtain for actions that benefit the user;
each has instant, ongoing, and max credit rewards apps could gain [CHAR LIMIT=40]-->
<string-array name="tare_rewards_subfactors" translatable="false">
<item>@string/tare_top_activity</item>
<item>@string/tare_notification_seen</item>
<item>@string/tare_notification_seen_15_min</item>
<item>@string/tare_notification_interaction</item>
<item>@string/tare_widget_interaction</item>
<item>@string/tare_other_interaction</item>
</string-array>
<!-- Array used to populate dropdown menu with the different policies in the TARE
settings [CHAR LIMIT=40]-->
<string-array name="tare_policies" translatable="false">
<item>@string/tare_alarmmanager</item>
</string-array>
</resources>