Merge "Update Backup & reset settings to launch the configured activity." into nyc-mr1-dev
diff --git a/res/drawable/fallback_home_unprovisioned_background.xml b/res/drawable/fallback_home_unprovisioned_background.xml
new file mode 100644
index 0000000..9ec3874
--- /dev/null
+++ b/res/drawable/fallback_home_unprovisioned_background.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 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
+ -->
+
+<color xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="#000000" />
\ No newline at end of file
diff --git a/res/layout/support_escalation_options.xml b/res/layout/support_escalation_options.xml
index 6b88908..b214561 100644
--- a/res/layout/support_escalation_options.xml
+++ b/res/layout/support_escalation_options.xml
@@ -17,51 +17,71 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@style/SupportEscalationCard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@color/card_background_grey"
- android:gravity="center_horizontal"
- android:paddingBottom="40dp">
- <LinearLayout
- android:layout_width="wrap_content"
+ android:orientation="vertical">
+ <TextView
+ android:id="@+id/tile_title"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginStart="8dp"
- android:layout_marginEnd="8dp"
android:gravity="center_horizontal"
- android:orientation="vertical">
- <Button
- android:id="@android:id/text1"
- style="@style/SupportPrimaryButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_margin="8dp"/>
- <TextView
- android:id="@+id/summary1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="14dp"
- android:textAppearance="@style/TextAppearance.Small"
- android:textColor="?android:attr/textColorSecondary"/>
- </LinearLayout>
- <LinearLayout
- android:layout_width="wrap_content"
+ android:textAppearance="@style/TextAppearance.SupportTitle"/>
+ <TextView
+ android:id="@+id/tile_summary"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginStart="8dp"
- android:layout_marginEnd="8dp"
android:gravity="center_horizontal"
- android:orientation="vertical">
- <Button
- android:id="@android:id/text2"
- style="@style/SupportPrimaryButton"
+ android:paddingTop="8dp"
+ android:paddingBottom="30dp"
+ android:textAppearance="@style/TextAppearance.Small"
+ android:textColor="?android:attr/textColorSecondary"/>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:orientation="horizontal">
+ <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_margin="8dp"/>
- <TextView
- android:id="@+id/summary2"
+ android:layout_marginStart="8dp"
+ android:layout_marginEnd="8dp"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+ <Button
+ android:id="@android:id/text1"
+ style="@style/SupportPrimaryButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="8dp"/>
+ <TextView
+ android:id="@+id/summary1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="14dp"
+ android:textAppearance="@style/TextAppearance.Small"
+ android:textColor="?android:attr/textColorSecondary"/>
+ </LinearLayout>
+ <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginTop="14dp"
- android:textAppearance="@style/TextAppearance.Small"
- android:textColor="?android:attr/textColorSecondary"/>
+ android:layout_marginStart="8dp"
+ android:layout_marginEnd="8dp"
+ android:gravity="center_horizontal"
+ android:orientation="vertical">
+ <Button
+ android:id="@android:id/text2"
+ style="@style/SupportPrimaryButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="8dp"/>
+ <TextView
+ android:id="@+id/summary2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="14dp"
+ android:textAppearance="@style/TextAppearance.Small"
+ android:textColor="?android:attr/textColorSecondary"/>
+ </LinearLayout>
</LinearLayout>
</LinearLayout>
diff --git a/res/layout/support_item_title.xml b/res/layout/support_item_title.xml
deleted file mode 100644
index 0110da0..0000000
--- a/res/layout/support_item_title.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2016 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:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@color/card_background_grey"
- android:paddingTop="40dp"
- android:paddingBottom="42dp"
- android:paddingStart="56dp"
- android:paddingEnd="56dp"
- android:orientation="vertical">
- <TextView
- android:id="@android:id/text1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:textAppearance="@style/TextAppearance.SupportTitle"/>
- <TextView
- android:id="@android:id/text2"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:paddingTop="8dp"
- android:textAppearance="@style/TextAppearance.Small"
- android:textColor="?android:attr/textColorSecondary"/>
-</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/support_offline_escalation_options.xml b/res/layout/support_offline_escalation_options.xml
index 43be55f..d1e77a3 100644
--- a/res/layout/support_offline_escalation_options.xml
+++ b/res/layout/support_offline_escalation_options.xml
@@ -17,13 +17,25 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@style/SupportEscalationCard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@color/card_background_grey"
- android:gravity="center_horizontal"
- android:paddingBottom="40dp"
android:orientation="vertical">
-
+ <TextView
+ android:id="@+id/tile_title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:textAppearance="@style/TextAppearance.SupportTitle"/>
+ <TextView
+ android:id="@+id/tile_summary"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:paddingTop="8dp"
+ android:paddingBottom="10dp"
+ android:textAppearance="@style/TextAppearance.Small"
+ android:textColor="?android:attr/textColorSecondary"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -31,6 +43,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:paddingEnd="8dp"
android:text="@string/support_country_list_title"
android:textAppearance="@style/TextAppearance.Small"
android:textColor="?android:attr/textColorSecondary"/>
diff --git a/res/layout/support_sign_in_button.xml b/res/layout/support_sign_in_button.xml
index fb789e8..45de571 100644
--- a/res/layout/support_sign_in_button.xml
+++ b/res/layout/support_sign_in_button.xml
@@ -17,11 +17,25 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ style="@style/SupportEscalationCard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@color/card_background_grey"
- android:gravity="center_horizontal"
android:orientation="vertical">
+ <TextView
+ android:id="@+id/tile_title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:textAppearance="@style/TextAppearance.SupportTitle"/>
+ <TextView
+ android:id="@+id/tile_summary"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:paddingTop="8dp"
+ android:paddingBottom="30dp"
+ android:textAppearance="@style/TextAppearance.Small"
+ android:textColor="?android:attr/textColorSecondary"/>
<Button
android:id="@android:id/text1"
style="@style/SupportPrimaryButton"
diff --git a/res/layout/support_tile.xml b/res/layout/support_tile.xml
index e07e173..5f7ced4 100644
--- a/res/layout/support_tile.xml
+++ b/res/layout/support_tile.xml
@@ -31,7 +31,7 @@
android:layout_marginStart="@dimen/dashboard_tile_image_margin_start"
android:layout_marginEnd="@dimen/dashboard_tile_image_margin_end"/>
<TextView
- android:id="@android:id/text1"
+ android:id="@+id/tile_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c15236c..5073893 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5621,6 +5621,8 @@
<string name="help_url_remote_display" translatable="false"></string>
<!-- Help URL, Fingerprint [DO NOT TRANSLATE] -->
<string name="help_url_fingerprint" translatable="false"></string>
+ <!-- Help URL, Gesture settings -->
+ <string name="help_url_gestures" translatable="false"></string>
<!-- User account title [CHAR LIMIT=30] -->
<string name="user_account_title">Account for content</string>
@@ -7535,9 +7537,6 @@
<xliff:g id="language" example="English">%s</xliff:g> (<xliff:g id="phone" example="800-000-0000">%s</xliff:g>)
</string>
- <!-- Title text for support options when there is no internet access. [CHAR LIMIT=80]-->
- <string name="support_offline_title">Call us toll-free</string>
-
<!-- Title text for a list of international support phone numbers. [CHAR LIMIT=60]-->
<string name="support_international_phone_title">Traveling aboard?</string>
@@ -7627,7 +7626,7 @@
<string name="bluetooth_talkback_bluetooth">Bluetooth</string>
<!-- Used as title on the automatic storage manager settings. [CHAR LIMIT=60] -->
- <string name="automatic_storage_manager_settings">Storage manager</string>
+ <string name="automatic_storage_manager_settings">Manage storage</string>
<!-- Used as wall of text to describe the feature. [CHAR LIMIT=NONE] -->
<string name="automatic_storage_manager_text">To help free up storage space, storage manager removes backed up photos and videos from your device.</string>
@@ -7645,7 +7644,7 @@
<string name="deletion_helper_manual_title">Manual</string>
<!-- Preference menu title for accessing the deletion helper from the storage manager settings. [CHAR LIMIT=30]-->
- <string name="deletion_helper_preference_title">Free space now</string>
+ <string name="deletion_helper_preference_title">Free up space now</string>
<!-- Preference title for gesture settings [CHAR LIMIT=25]-->
<string name="gesture_preference_title">Gestures</string>
@@ -7684,4 +7683,7 @@
<string name="oem_unlock_enable_disabled_summary_connectivity">Connect to the Internet first</string>
<!-- setting enable OEM unlock Checkbox's summary to explain this Checkbox is disabled because this setting is unavailable on sim-locked devices. [CHAR_LIMIT=60] -->
<string name="oem_unlock_enable_disabled_summary_sim_locked_device">Unavailable on carrier-locked devices</string>
+
+ <string name="automatic_storage_manager_freed_bytes"><xliff:g id="size" example="3.25MB">%1$s</xliff:g> total made available\n\nLast ran on <xliff:g id="date" example="Jan 12">%2$s</xliff:g></string>
+
</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 1942a4c..cc6dc30 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -424,4 +424,12 @@
<item name="android:textAppearance">@android:style/TextAppearance.Material.Subhead</item>
</style>
+ <style name="SupportEscalationCard">
+ <item name="android:background">@color/card_background_grey</item>
+ <item name="android:gravity">center</item>
+ <item name="android:minHeight">368dp</item>
+ <item name="android:paddingStart">56dp</item>
+ <item name="android:paddingEnd">56dp</item>
+ </style>
+
</resources>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 43bb55c..e09a02d 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -293,4 +293,13 @@
<item name="android:navigationBarColor">#00000000</item>
</style>
+ <style name="FallbackHome.SetupWizard" parent="@android:style/Theme.Material.NoActionBar.Fullscreen">
+ <item name="android:windowBackground">@drawable/fallback_home_unprovisioned_background</item>
+ <item name="android:colorBackgroundCacheHint">@null</item>
+ <item name="android:windowNoTitle">true</item>
+ <item name="android:windowDrawsSystemBarBackgrounds">true</item>
+ <item name="android:statusBarColor">#00000000</item>
+ <item name="android:navigationBarColor">#00000000</item>
+ </style>
+
</resources>
diff --git a/res/xml/automatic_storage_management_settings.xml b/res/xml/automatic_storage_management_settings.xml
index 282f89a..2320257 100644
--- a/res/xml/automatic_storage_management_settings.xml
+++ b/res/xml/automatic_storage_management_settings.xml
@@ -27,12 +27,21 @@
android:title="@string/automatic_storage_manager_preference_title"
android:summary="@string/automatic_storage_manager_text"/>
+
+ <com.android.settings.fuelgauge.WallOfTextPreference
+ android:key="freed_bytes"
+ android:persistent="false"
+ android:selectable="false"
+ settings:allowDividerAbove="false"
+ settings:allowDividerBelow="true" />
+
<DropDownPreference
android:key="days"
android:summary="%s"
android:title="@string/automatic_storage_manager_days_title"
android:entries="@array/automatic_storage_management_days"
- android:entryValues="@array/automatic_storage_management_days_values"/>
+ android:entryValues="@array/automatic_storage_management_days_values"
+ settings:allowDividerAbove="true" />
</PreferenceCategory>
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index 19c4a3f..dd8064f 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -283,7 +283,7 @@
CarrierConfigManager configManager =
(CarrierConfigManager) getSystemService(Context.CARRIER_CONFIG_SERVICE);
PersistableBundle b = configManager.getConfig();
- if (b.getBoolean(CarrierConfigManager.KEY_CI_ACTION_ON_SYS_UPDATE_BOOL)) {
+ if (b != null && b.getBoolean(CarrierConfigManager.KEY_CI_ACTION_ON_SYS_UPDATE_BOOL)) {
ciActionOnSysUpdate(b);
}
}
diff --git a/src/com/android/settings/FallbackHome.java b/src/com/android/settings/FallbackHome.java
index deb01a1..158f672 100644
--- a/src/com/android/settings/FallbackHome.java
+++ b/src/com/android/settings/FallbackHome.java
@@ -28,6 +28,7 @@
import android.os.UserManager;
import android.provider.Settings;
import android.util.Log;
+import android.view.View;
import java.util.Objects;
@@ -42,7 +43,9 @@
// we don't flash the wallpaper before SUW
if (Settings.Global.getInt(getContentResolver(),
Settings.Global.DEVICE_PROVISIONED, 0) == 0) {
- setTheme(android.R.style.Theme_Black_NoTitleBar_Fullscreen);
+ setTheme(R.style.FallbackHome_SetupWizard);
+ getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
registerReceiver(mReceiver, new IntentFilter(Intent.ACTION_USER_UNLOCKED));
diff --git a/src/com/android/settings/dashboard/SupportItemAdapter.java b/src/com/android/settings/dashboard/SupportItemAdapter.java
index 8f2be01..678226a 100644
--- a/src/com/android/settings/dashboard/SupportItemAdapter.java
+++ b/src/com/android/settings/dashboard/SupportItemAdapter.java
@@ -56,7 +56,6 @@
public final class SupportItemAdapter extends RecyclerView.Adapter<SupportItemAdapter.ViewHolder> {
private static final String STATE_SELECTED_COUNTRY = "STATE_SELECTED_COUNTRY";
- private static final int TYPE_TITLE = R.layout.support_item_title;
private static final int TYPE_ESCALATION_OPTIONS = R.layout.support_escalation_options;
private static final int TYPE_ESCALATION_OPTIONS_OFFLINE =
R.layout.support_offline_escalation_options;
@@ -104,13 +103,13 @@
final SupportData data = mSupportData.get(position);
switch (holder.getItemViewType()) {
case TYPE_SIGN_IN_BUTTON:
- bindSignInPromoTile(holder, data);
+ bindSignInPromoTile(holder, (EscalationData) data);
break;
case TYPE_ESCALATION_OPTIONS:
- bindEscalationOptions(holder, data);
+ bindEscalationOptions(holder, (EscalationData) data);
break;
case TYPE_ESCALATION_OPTIONS_OFFLINE:
- bindOfflineEscalationOptions(holder, (OfflineSupportData) data);
+ bindOfflineEscalationOptions(holder, (OfflineEscalationData) data);
break;
default:
bindSupportTile(holder, data);
@@ -183,44 +182,36 @@
mSupportFeatureProvider.isSupportTypeEnabled(mActivity, PHONE);
final boolean hasChatOperation =
mSupportFeatureProvider.isSupportTypeEnabled(mActivity, CHAT);
+ final EscalationData.Builder builder = new EscalationData.Builder(mActivity);
if (!hasPhoneOperation && !hasChatOperation) {
// No support at all.
- mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
- .setText1(R.string.support_escalation_title)
- .setText2(mActivity.getString(R.string.support_escalation_unavailable_summary))
- .build());
+ builder.setTileTitle(R.string.support_escalation_title)
+ .setTileSummary(R.string.support_escalation_unavailable_summary);
} else if (mSupportFeatureProvider.isAlwaysOperating(PHONE, null /* countryCode */)
|| mSupportFeatureProvider.isAlwaysOperating(CHAT, null /* countryCode */)) {
// Support is available.
- mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
- .setText1(R.string.support_escalation_24_7_title)
- .setText2(mActivity.getString(R.string.support_escalation_24_7_summary))
- .build());
+ builder.setTileTitle(R.string.support_escalation_24_7_title)
+ .setTileSummary(mActivity.getString(R.string.support_escalation_24_7_summary));
} else if (mSupportFeatureProvider.isOperatingNow(PHONE)
|| mSupportFeatureProvider.isOperatingNow(CHAT)) {
// Support is available now.
- mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
- .setText1(R.string.support_escalation_title)
- .setText2(R.string.support_escalation_summary)
- .build());
+ builder.setTileTitle(R.string.support_escalation_title)
+ .setTileSummary(R.string.support_escalation_summary);
} else {
// Support is not temporarily unavailable.
- mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
- .setText1(R.string.support_escalation_title)
- .setText2(mSupportFeatureProvider.getOperationHours(mActivity, PHONE, null))
- .build());
+ builder.setTileTitle(R.string.support_escalation_title)
+ .setTileSummary(
+ mSupportFeatureProvider.getOperationHours(mActivity, PHONE, null));
}
- final SupportData.Builder builder =
- new SupportData.Builder(mActivity, TYPE_ESCALATION_OPTIONS);
if (hasPhoneOperation) {
- builder.setText1(R.string.support_escalation_by_phone);
- builder.setSummary1(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, PHONE));
- builder.setEnabled1(mSupportFeatureProvider.isOperatingNow(PHONE));
+ builder.setText1(R.string.support_escalation_by_phone)
+ .setSummary1(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, PHONE))
+ .setEnabled1(mSupportFeatureProvider.isOperatingNow(PHONE));
}
if (hasChatOperation) {
- builder.setText2(R.string.support_escalation_by_chat);
- builder.setSummary2(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, CHAT));
- builder.setEnabled2(mSupportFeatureProvider.isOperatingNow(CHAT));
+ builder.setText2(R.string.support_escalation_by_chat)
+ .setSummary2(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, CHAT))
+ .setEnabled2(mSupportFeatureProvider.isOperatingNow(CHAT));
}
mSupportData.add(builder.build());
}
@@ -233,46 +224,44 @@
operatingHours = mSupportFeatureProvider.getOperationHours(mActivity,
PHONE, mSelectedCountry);
}
- mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
- .setText1(R.string.support_offline_title)
- .setText2(operatingHours)
- .build());
- final OfflineSupportData.Builder builder = new OfflineSupportData.Builder(mActivity);
- builder.setCountries(mSupportFeatureProvider.getPhoneSupportCountries())
+ mSupportData.add(new OfflineEscalationData.Builder(mActivity)
+ .setCountries(mSupportFeatureProvider.getPhoneSupportCountries())
.setTollFreePhone(mSupportFeatureProvider.getSupportPhones(
mSelectedCountry, true /* isTollFree */))
.setTolledPhone(mSupportFeatureProvider.getSupportPhones(
- mSelectedCountry, false /* isTollFree */));
- mSupportData.add(builder.build());
+ mSelectedCountry, false /* isTollFree */))
+ .setTileTitle(R.string.support_escalation_title)
+ .setTileSummary(operatingHours)
+ .build());
}
private void addSignInPromo() {
- mSupportData.add(new SupportData.Builder(mActivity, TYPE_TITLE)
- .setText1(R.string.support_sign_in_required_title)
- .setText2(R.string.support_sign_in_required_summary)
- .build());
- mSupportData.add(new SupportData.Builder(mActivity, TYPE_SIGN_IN_BUTTON)
+ mSupportData.add(new EscalationData.Builder(mActivity, TYPE_SIGN_IN_BUTTON)
.setText1(R.string.support_sign_in_button_text)
.setText2(R.string.support_sign_in_required_help)
+ .setTileTitle(R.string.support_sign_in_required_title)
+ .setTileSummary(R.string.support_sign_in_required_summary)
.build());
}
private void addMoreHelpItems() {
mSupportData.add(new SupportData.Builder(mActivity, TYPE_SUPPORT_TILE)
.setIcon(R.drawable.ic_help_24dp)
- .setText1(R.string.support_help_feedback_title)
+ .setTileTitle(R.string.support_help_feedback_title)
.setIntent(mSupportFeatureProvider.getHelpIntent(mActivity))
.setMetricsEvent(MetricsProto.MetricsEvent.ACTION_SUPPORT_HELP_AND_FEEDBACK)
.build());
mSupportData.add(new SupportData.Builder(mActivity, TYPE_SUPPORT_TILE)
.setIcon(R.drawable.ic_lightbulb_outline_24)
- .setText1(R.string.support_tips_and_tricks_title)
+ .setTileTitle(R.string.support_tips_and_tricks_title)
.setIntent(mSupportFeatureProvider.getTipsAndTricksIntent(mActivity))
.setMetricsEvent(MetricsProto.MetricsEvent.ACTION_SUPPORT_TIPS_AND_TRICKS)
.build());
}
- private void bindEscalationOptions(ViewHolder holder, SupportData data) {
+ private void bindEscalationOptions(ViewHolder holder, EscalationData data) {
+ holder.tileTitleView.setText(data.tileTitle);
+ holder.tileSummaryView.setText(data.tileSummary);
if (data.text1 == 0) {
holder.text1View.setVisibility(View.GONE);
} else {
@@ -299,7 +288,10 @@
}
}
- private void bindOfflineEscalationOptions(ViewHolder holder, OfflineSupportData data) {
+ private void bindOfflineEscalationOptions(ViewHolder holder, OfflineEscalationData data) {
+ // Bind Title
+ holder.tileTitleView.setText(data.tileTitle);
+ holder.tileSummaryView.setText(data.tileSummary);
// Bind spinner
final Spinner spinner = (Spinner) holder.itemView.findViewById(R.id.spinner);
final ArrayAdapter<String> adapter = new ArrayAdapter(
@@ -331,7 +323,9 @@
}
}
- private void bindSignInPromoTile(ViewHolder holder, SupportData data) {
+ private void bindSignInPromoTile(ViewHolder holder, EscalationData data) {
+ holder.tileTitleView.setText(data.tileTitle);
+ holder.tileSummaryView.setText(data.tileSummary);
holder.text1View.setText(data.text1);
holder.text2View.setText(data.text2);
holder.text1View.setOnClickListener(mEscalationClickListener);
@@ -342,11 +336,11 @@
if (holder.iconView != null) {
holder.iconView.setImageResource(data.icon);
}
- if (holder.text1View != null) {
- holder.text1View.setText(data.text1);
+ if (holder.tileTitleView != null) {
+ holder.tileTitleView.setText(data.tileTitle);
}
- if (holder.text2View != null) {
- holder.text2View.setText(data.text2);
+ if (holder.tileSummaryView != null) {
+ holder.tileSummaryView.setText(data.tileSummary);
}
holder.itemView.setOnClickListener(mItemClickListener);
}
@@ -445,6 +439,8 @@
static final class ViewHolder extends RecyclerView.ViewHolder {
final ImageView iconView;
+ final TextView tileTitleView;
+ final TextView tileSummaryView;
final TextView text1View;
final TextView text2View;
final TextView summary1View;
@@ -453,6 +449,8 @@
ViewHolder(View itemView) {
super(itemView);
iconView = (ImageView) itemView.findViewById(android.R.id.icon);
+ tileTitleView = (TextView) itemView.findViewById(R.id.tile_title);
+ tileSummaryView = (TextView) itemView.findViewById(R.id.tile_summary);
text1View = (TextView) itemView.findViewById(android.R.id.text1);
text2View = (TextView) itemView.findViewById(android.R.id.text2);
summary1View = (TextView) itemView.findViewById(R.id.summary1);
@@ -472,40 +470,29 @@
@DrawableRes
final int icon;
@StringRes
- final int text1;
- final CharSequence text2;
- final boolean enabled1;
- final boolean enabled2;
- final CharSequence summary1;
- final CharSequence summary2;
+ final int tileTitle;
+ final CharSequence tileSummary;
+
private SupportData(Builder builder) {
this.type = builder.mType;
this.icon = builder.mIcon;
- this.text1 = builder.mText1;
- this.text2 = builder.mText2;
- this.summary1 = builder.mSummary1;
- this.summary2 = builder.mSummary2;
- this.enabled1 = builder.mEnabled1;
- this.enabled2 = builder.mEnabled2;
+ this.tileTitle = builder.mTileTitle;
+ this.tileSummary = builder.mTileSummary;
this.intent = builder.mIntent;
this.metricsEvent = builder.mMetricsEvent;
}
static class Builder {
- private final Context mContext;
+ protected final Context mContext;
@LayoutRes
private final int mType;
@DrawableRes
private int mIcon;
- private boolean mEnabled1;
- private boolean mEnabled2;
@StringRes
- private int mText1;
- private CharSequence mText2;
- private CharSequence mSummary1;
- private CharSequence mSummary2;
+ private int mTileTitle;
+ private CharSequence mTileSummary;
private Intent mIntent;
private int mMetricsEvent = -1;
@@ -519,6 +506,78 @@
return this;
}
+ Builder setTileTitle(@StringRes int title) {
+ mTileTitle = title;
+ return this;
+ }
+
+ Builder setTileSummary(@StringRes int summary) {
+ mTileSummary = mContext.getString(summary);
+ return this;
+ }
+
+ Builder setTileSummary(CharSequence summary) {
+ mTileSummary = summary;
+ return this;
+ }
+
+ Builder setMetricsEvent(int metricsEvent) {
+ mMetricsEvent = metricsEvent;
+ return this;
+ }
+
+ Builder setIntent(Intent intent) {
+ mIntent = intent;
+ return this;
+ }
+
+ SupportData build() {
+ return new SupportData(this);
+ }
+ }
+ }
+
+ /**
+ * Data model for escalation cards.
+ */
+ private static class EscalationData extends SupportData {
+
+ @StringRes
+ final int text1;
+ final CharSequence text2;
+ final boolean enabled1;
+ final boolean enabled2;
+ final CharSequence summary1;
+ final CharSequence summary2;
+
+ private EscalationData(Builder builder) {
+ super(builder);
+ this.text1 = builder.mText1;
+ this.text2 = builder.mText2;
+ this.summary1 = builder.mSummary1;
+ this.summary2 = builder.mSummary2;
+ this.enabled1 = builder.mEnabled1;
+ this.enabled2 = builder.mEnabled2;
+ }
+
+ static class Builder extends SupportData.Builder {
+
+ @StringRes
+ private int mText1;
+ private CharSequence mText2;
+ private CharSequence mSummary1;
+ private CharSequence mSummary2;
+ private boolean mEnabled1;
+ private boolean mEnabled2;
+
+ protected Builder(Context context, @LayoutRes int type) {
+ super(context, type);
+ }
+
+ Builder(Context context) {
+ this(context, TYPE_ESCALATION_OPTIONS);
+ }
+
Builder setEnabled1(boolean enabled) {
mEnabled1 = enabled;
return this;
@@ -554,18 +613,8 @@
return this;
}
- Builder setMetricsEvent(int metricsEvent) {
- mMetricsEvent = metricsEvent;
- return this;
- }
-
- Builder setIntent(Intent intent) {
- mIntent = intent;
- return this;
- }
-
- SupportData build() {
- return new SupportData(this);
+ EscalationData build() {
+ return new EscalationData(this);
}
}
}
@@ -573,20 +622,20 @@
/**
* Support data for offline mode.
*/
- private static final class OfflineSupportData extends SupportData {
+ private static final class OfflineEscalationData extends EscalationData {
final List<String> countries;
final SupportPhone tollFreePhone;
final SupportPhone tolledPhone;
- private OfflineSupportData(Builder builder) {
+ private OfflineEscalationData(Builder builder) {
super(builder);
countries = builder.mCountries;
tollFreePhone = builder.mTollFreePhone;
tolledPhone = builder.mTolledPhone;
}
- static final class Builder extends SupportData.Builder {
+ static final class Builder extends EscalationData.Builder {
private List<String> mCountries;
private SupportPhone mTollFreePhone;
@@ -611,8 +660,8 @@
return this;
}
- OfflineSupportData build() {
- return new OfflineSupportData(this);
+ OfflineEscalationData build() {
+ return new OfflineEscalationData(this);
}
}
}
diff --git a/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java b/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java
index 318dea6..1b64fc4 100644
--- a/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java
+++ b/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java
@@ -17,12 +17,15 @@
package com.android.settings.deletionhelper;
import android.app.Activity;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.storage.StorageManager;
import android.provider.Settings;
+import android.text.format.DateUtils;
+import android.text.format.Formatter;
import android.util.Log;
import android.view.View;
import android.widget.Switch;
@@ -49,9 +52,11 @@
private static final String KEY_DAYS = "days";
private static final String KEY_DELETION_HELPER = "deletion_helper";
+ private static final String KEY_FREED = "freed_bytes";
private static final String KEY_STORAGE_MANAGER_SWITCH = "storage_manager_active";
private DropDownPreference mDaysToRetain;
+ private Preference mFreedBytes;
private Preference mDeletionHelper;
private SwitchPreference mStorageManagerSwitch;
@@ -67,18 +72,37 @@
mDaysToRetain = (DropDownPreference) findPreference(KEY_DAYS);
mDaysToRetain.setOnPreferenceChangeListener(this);
+ mFreedBytes = findPreference(KEY_FREED);
+
mDeletionHelper = findPreference(KEY_DELETION_HELPER);
mDeletionHelper.setOnPreferenceClickListener(this);
mStorageManagerSwitch = (SwitchPreference) findPreference(KEY_STORAGE_MANAGER_SWITCH);
mStorageManagerSwitch.setOnPreferenceChangeListener(this);
- int value = Settings.Secure.getInt(getContentResolver(),
+ ContentResolver cr = getContentResolver();
+ int value = Settings.Secure.getInt(cr,
Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_DEFAULT);
String[] stringValues =
getResources().getStringArray(R.array.automatic_storage_management_days_values);
mDaysToRetain.setValue(stringValues[daysValueToIndex(value, stringValues)]);
+
+ long freedBytes = Settings.Secure.getLong(cr,
+ Settings.Secure.AUTOMATIC_STORAGE_MANAGER_BYTES_CLEARED,
+ 0);
+ long lastRunMillis = Settings.Secure.getLong(cr,
+ Settings.Secure.AUTOMATIC_STORAGE_MANAGER_LAST_RUN,
+ 0);
+ if (freedBytes == 0 || lastRunMillis == 0) {
+ mFreedBytes.setVisible(false);
+ } else {
+ Activity activity = getActivity();
+ mFreedBytes.setSummary(activity.getString(
+ R.string.automatic_storage_manager_freed_bytes,
+ Formatter.formatFileSize(activity, freedBytes),
+ DateUtils.formatDateTime(activity, lastRunMillis, DateUtils.FORMAT_SHOW_DATE)));
+ }
}
@Override
diff --git a/src/com/android/settings/gestures/GestureSettings.java b/src/com/android/settings/gestures/GestureSettings.java
index d40665f..cafba68 100644
--- a/src/com/android/settings/gestures/GestureSettings.java
+++ b/src/com/android/settings/gestures/GestureSettings.java
@@ -110,6 +110,11 @@
}
@Override
+ protected int getHelpResource() {
+ return R.string.help_url_gestures;
+ }
+
+ @Override
protected int getMetricsCategory() {
return MetricsEvent.SETTINGS_GESTURES;
}
diff --git a/src/com/android/settings/search/Index.java b/src/com/android/settings/search/Index.java
index fd67ea6..976c6fb 100644
--- a/src/com/android/settings/search/Index.java
+++ b/src/com/android/settings/search/Index.java
@@ -1165,17 +1165,6 @@
return result.toString();
}
- private int getResId(Context context, AttributeSet set, int[] attrs, int resId) {
- final TypedArray sa = context.obtainStyledAttributes(set, attrs);
- final TypedValue tv = sa.peekValue(resId);
-
- if (tv != null && tv.type == TypedValue.TYPE_STRING) {
- return tv.resourceId;
- } else {
- return 0;
- }
- }
-
/**
* A private class for updating the Index database
*/