Merge "More updates to battery optimization whitelist" into mnc-dev
diff --git a/res/layout/app_storage_settings.xml b/res/layout/app_storage_settings.xml
deleted file mode 100644
index 82493f7..0000000
--- a/res/layout/app_storage_settings.xml
+++ /dev/null
@@ -1,151 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2015 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:id="@+id/all_details"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingStart="?android:attr/listPreferredItemPaddingStart"
- android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
- android:orientation="vertical">
-
- <TextView xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/category_title"
- android:layout_width="match_parent"
- android:layout_height="@dimen/dashboard_category_title_height"
- android:singleLine="true"
- android:gravity="center_vertical"
- android:textAppearance="@style/TextAppearance.CategoryTitle"
- android:textAlignment="viewStart"
- android:text="@string/storage_label"
- />
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingTop="0dip">
- <TextView
- android:id="@+id/total_size_prefix"
- android:text="@string/total_size_label"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:textColor="?android:textColorPrimary"
- android:maxLines="1" />
- <TextView
- android:id="@+id/total_size_text"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:gravity="right"
- android:maxLines="1" />
- </FrameLayout>
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingTop="3dip">
- <TextView
- android:id="@+id/application_size_prefix"
- android:text="@string/application_size_label"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:textColor="?android:textColorPrimary"
- android:maxLines="1" />
- <TextView
- android:id="@+id/application_size_text"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:gravity="right"
- android:maxLines="1" />
- </FrameLayout>
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingTop="3dip">
- <TextView
- android:id="@+id/external_code_size_prefix"
- android:text="@string/external_code_size_label"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:textColor="?android:textColorPrimary"
- android:maxLines="1" />
- <TextView
- android:id="@+id/external_code_size_text"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:gravity="right"
- android:maxLines="1" />
- </FrameLayout>
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingTop="3dip">
- <TextView
- android:id="@+id/data_size_prefix"
- android:text="@string/data_size_label"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:textColor="?android:textColorPrimary"
- android:maxLines="1" />
- <TextView
- android:id="@+id/data_size_text"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:gravity="right"
- android:maxLines="1" />
- </FrameLayout>
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingTop="3dip">
- <TextView
- android:id="@+id/external_data_size_prefix"
- android:text="@string/external_data_size_label"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:textColor="?android:textColorPrimary"
- android:maxLines="1" />
- <TextView
- android:id="@+id/external_data_size_text"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:gravity="right"
- android:maxLines="1" />
- </FrameLayout>
-
- <include
- android:id="@+id/clear_data_button"
- layout="@layout/single_button_panel" />
-
- <Space
- android:layout_width="match_parent"
- android:layout_height="10dp" />
-
-</LinearLayout>
diff --git a/res/layout/horizontal_preference.xml b/res/layout/horizontal_preference.xml
index 540b7e3..4e16e9a 100644
--- a/res/layout/horizontal_preference.xml
+++ b/res/layout/horizontal_preference.xml
@@ -20,7 +20,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
- android:paddingTop="3dp"
+ android:paddingTop="1dp"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
diff --git a/res/layout/single_button_panel.xml b/res/layout/single_button_panel.xml
index 5f1fee9..2af1765 100755
--- a/res/layout/single_button_panel.xml
+++ b/res/layout/single_button_panel.xml
@@ -22,15 +22,20 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:gravity="bottom"
- android:paddingTop="4dip"
+ android:paddingTop="6dip"
+ android:paddingBottom="6dip"
android:orientation="horizontal">
<Button
android:id="@+id/button"
android:layout_width="120dip"
android:layout_weight="0.4"
android:layout_height="wrap_content"
- android:layout_gravity="center_vertical" />
+ android:layout_gravity="center_vertical"
+ android:backgroundTint="?android:attr/colorAccent"
+ android:textColor="@android:color/white" />
<Space
android:layout_width="0dip"
android:layout_height="wrap_content"
diff --git a/res/layout/tall_preference_category.xml b/res/layout/tall_preference_category.xml
new file mode 100644
index 0000000..7a5dd77
--- /dev/null
+++ b/res/layout/tall_preference_category.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<!-- Based on frameworks/base/core/res/res/layout/preference_category_material.xml.
+ except has paddingBottom set.-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+android:id/title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="16dip"
+ android:textAppearance="@android:style/TextAppearance.Material.Body2"
+ android:textColor="?android:attr/colorAccent"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ android:paddingBottom="8dp"
+ android:paddingTop="16dip" />
diff --git a/res/values/themes.xml b/res/values/themes.xml
index a0dd581..76fc04f 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -30,6 +30,8 @@
</style>
<style name="SetupWizardTheme" parent="SuwThemeMaterial">
+ <!-- For all Alert Dialogs -->
+ <item name="android:alertDialogTheme">@style/ThemeOverlay.AlertDialog</item>
<item name="android:listPreferredItemPaddingEnd">@dimen/suw_layout_margin_sides</item>
<item name="android:listPreferredItemPaddingStart">@dimen/suw_layout_margin_sides</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
@@ -50,6 +52,8 @@
</style>
<style name="SetupWizardTheme.Light" parent="SuwThemeMaterial.Light">
+ <!-- For all Alert Dialogs -->
+ <item name="android:alertDialogTheme">@style/ThemeOverlay.AlertDialog</item>
<item name="android:listPreferredItemPaddingEnd">@dimen/suw_layout_margin_sides</item>
<item name="android:listPreferredItemPaddingStart">@dimen/suw_layout_margin_sides</item>
<item name="android:windowBackground">?android:attr/colorBackground</item>
@@ -160,6 +164,10 @@
<item name="preferenceBackgroundColor">@drawable/preference_background</item>
</style>
+ <style name="ThemeOverlay.AlertDialog" parent="@android:style/ThemeOverlay.Material.Dialog.Alert">
+ <item name="android:windowSoftInputMode">adjustResize</item>
+ </style>
+
<style name="Theme.AlertDialog" parent="@*android:style/Theme.Material.Settings.Dialog.Alert">
<item name="android:windowSoftInputMode">adjustResize</item>
diff --git a/res/xml/app_storage_settings.xml b/res/xml/app_storage_settings.xml
index 6baaae1..5bb9204 100644
--- a/res/xml/app_storage_settings.xml
+++ b/res/xml/app_storage_settings.xml
@@ -23,12 +23,54 @@
android:summary="@string/storage_type_internal"
android:selectable="true" />
- <com.android.settings.applications.LayoutPreference
- android:key="storage_settings"
- android:layout="@layout/app_storage_settings" />
+ <PreferenceCategory
+ android:key="storage_category"
+ android:layout="@layout/tall_preference_category"
+ android:title="@string/storage_label">
+
+ <Preference
+ android:key="total_size"
+ android:title="@string/total_size_label"
+ android:selectable="false"
+ android:layout="@layout/horizontal_preference" />
+
+ <Preference
+ android:key="app_size"
+ android:title="@string/application_size_label"
+ android:selectable="false"
+ android:layout="@layout/horizontal_preference" />
+
+ <Preference
+ android:key="external_code_size"
+ android:title="@string/external_code_size_label"
+ android:selectable="false"
+ android:layout="@layout/horizontal_preference" />
+
+ <Preference
+ android:key="data_size"
+ android:title="@string/data_size_label"
+ android:selectable="false"
+ android:layout="@layout/horizontal_preference" />
+
+ <Preference
+ android:key="external_data_size"
+ android:title="@string/external_data_size_label"
+ android:selectable="false"
+ android:layout="@layout/horizontal_preference" />
+
+ <com.android.settings.applications.LayoutPreference
+ android:key="clear_data_button"
+ android:layout="@layout/single_button_panel" />
+ </PreferenceCategory>
+
+ <Preference
+ android:key="cache_size"
+ android:title="@string/cache_size_label"
+ android:layout="@layout/horizontal_preference" />
<com.android.settings.applications.LayoutPreference
- android:key="cache_settings"
- android:layout="@layout/app_cache_settings" />
+ android:key="clear_cache_button"
+ android:selectable="false"
+ android:layout="@layout/single_button_panel" />
</PreferenceScreen>
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index 7ab44ca..39866c9 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -61,7 +61,7 @@
android:fragment="com.android.settings.applications.RunningServices" />
<SwitchPreference
- android:key="tweak_ui"
+ android:key="tuner_ui"
android:persistent="false"
android:title="@string/system_ui_settings" />
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 4d89bf5..314e70a 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -97,7 +97,7 @@
*/
public static final String PREF_SHOW = "show";
- private static final ComponentName SYSUI_TWEAK = new ComponentName("com.android.systemui",
+ private static final ComponentName SYSUI_TUNER = new ComponentName("com.android.systemui",
"com.android.systemui.tuner.TunerActivity");
private static final String ENABLE_ADB = "enable_adb";
@@ -115,7 +115,7 @@
private static final String BUGREPORT = "bugreport";
private static final String BUGREPORT_IN_POWER_KEY = "bugreport_in_power";
private static final String OPENGL_TRACES_PROPERTY = "debug.egl.trace";
- private static final String TWEAK_UI_KEY = "tweak_ui";
+ private static final String TUNER_UI_KEY = "tuner_ui";
private static final String DEBUG_APP_KEY = "debug_app";
private static final String WAIT_FOR_DEBUGGER_KEY = "wait_for_debugger";
@@ -264,7 +264,7 @@
private Dialog mAdbKeysDialog;
private boolean mUnavailable;
- private SwitchPreference mTweakUiPref;
+ private SwitchPreference mTunerUiPref;
@Override
protected int getMetricsCategory() {
@@ -398,7 +398,7 @@
mAllPrefs.add(mShowAllANRs);
mResetSwitchPrefs.add(mShowAllANRs);
- mTweakUiPref = findAndInitSwitchPref(TWEAK_UI_KEY);
+ mTunerUiPref = findAndInitSwitchPref(TUNER_UI_KEY);
Preference hdcpChecking = findPreference(HDCP_CHECKING_KEY);
if (hdcpChecking != null) {
@@ -1079,15 +1079,15 @@
}
private void updateTweakUi() {
- updateSwitchPreference(mTweakUiPref, getActivity().getPackageManager()
- .getComponentEnabledSetting(SYSUI_TWEAK)
+ updateSwitchPreference(mTunerUiPref, getActivity().getPackageManager()
+ .getComponentEnabledSetting(SYSUI_TUNER)
== PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
- mTweakUiPref.setOnPreferenceChangeListener(this);
+ mTunerUiPref.setOnPreferenceChangeListener(this);
}
private void writeTweakUi(Object newValue) {
Boolean enabled = (Boolean) newValue;
- getActivity().getPackageManager().setComponentEnabledSetting(SYSUI_TWEAK,
+ getActivity().getPackageManager().setComponentEnabledSetting(SYSUI_TUNER,
enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
: PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);
@@ -1693,7 +1693,7 @@
} else if (preference == mSimulateColorSpace) {
writeSimulateColorSpace(newValue);
return true;
- } else if (preference == mTweakUiPref) {
+ } else if (preference == mTunerUiPref) {
writeTweakUi(newValue);
return true;
}
diff --git a/src/com/android/settings/applications/AppStorageSettings.java b/src/com/android/settings/applications/AppStorageSettings.java
index 5c367d7..fe68cbc4 100644
--- a/src/com/android/settings/applications/AppStorageSettings.java
+++ b/src/com/android/settings/applications/AppStorageSettings.java
@@ -29,6 +29,8 @@
import android.os.Message;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
+import android.preference.Preference;
+import android.preference.PreferenceCategory;
import android.text.format.Formatter;
import android.util.Log;
import android.view.View;
@@ -69,17 +71,26 @@
private static final int DLG_CANNOT_CLEAR_DATA = DLG_BASE + 2;
private static final String KEY_MOVE_PREFERENCE = "app_location_setting";
- private static final String KEY_STORAGE_SETTINGS = "storage_settings";
- private static final String KEY_CACHE_SETTINGS = "cache_settings";
+ private static final String KEY_STORAGE_CATEGORY = "storage_category";
- private TextView mTotalSize;
- private TextView mAppSize;
- private TextView mDataSize;
- private TextView mExternalCodeSize;
- private TextView mExternalDataSize;
+ private static final String KEY_TOTAL_SIZE = "total_size";
+ private static final String KEY_APP_SIZE = "app_size";
+ private static final String KEY_EXTERNAL_CODE_SIZE = "external_code_size";
+ private static final String KEY_DATA_SIZE = "data_size";
+ private static final String KEY_EXTERNAL_DATA_SIZE = "external_data_size";
+ private static final String KEY_CACHE_SIZE = "cache_size";
+
+ private static final String KEY_CLEAR_DATA = "clear_data_button";
+ private static final String KEY_CLEAR_CACHE = "clear_cache_button";
+
+ private Preference mTotalSize;
+ private Preference mAppSize;
+ private Preference mDataSize;
+ private Preference mExternalCodeSize;
+ private Preference mExternalDataSize;
// Views related to cache info
- private TextView mCacheSize;
+ private Preference mCacheSize;
private Button mClearDataButton;
private Button mClearCacheButton;
@@ -113,29 +124,28 @@
private void setupViews() {
mComputingStr = getActivity().getText(R.string.computing_size);
mInvalidSizeStr = getActivity().getText(R.string.invalid_size_value);
- LayoutPreference view = (LayoutPreference) findPreference(KEY_STORAGE_SETTINGS);
// Set default values on sizes
- mTotalSize = (TextView) view.findViewById(R.id.total_size_text);
- mAppSize = (TextView) view.findViewById(R.id.application_size_text);
- mDataSize = (TextView) view.findViewById(R.id.data_size_text);
- mExternalCodeSize = (TextView) view.findViewById(R.id.external_code_size_text);
- mExternalDataSize = (TextView) view.findViewById(R.id.external_data_size_text);
+ mTotalSize = findPreference(KEY_TOTAL_SIZE);
+ mAppSize = findPreference(KEY_APP_SIZE);
+ mDataSize = findPreference(KEY_DATA_SIZE);
+ mExternalCodeSize = findPreference(KEY_EXTERNAL_CODE_SIZE);
+ mExternalDataSize = findPreference(KEY_EXTERNAL_DATA_SIZE);
if (Environment.isExternalStorageEmulated()) {
- ((View) mExternalCodeSize.getParent()).setVisibility(View.GONE);
- ((View) mExternalDataSize.getParent()).setVisibility(View.GONE);
+ PreferenceCategory category = (PreferenceCategory) findPreference(KEY_STORAGE_CATEGORY);
+ category.removePreference(mExternalCodeSize);
+ category.removePreference(mExternalDataSize);
}
- mClearDataButton = (Button) view.findViewById(R.id.clear_data_button)
+ mClearDataButton = (Button) ((LayoutPreference) findPreference(KEY_CLEAR_DATA))
.findViewById(R.id.button);
mMoveDropDown = (DropDownPreference) findPreference(KEY_MOVE_PREFERENCE);
mMoveDropDown.setCallback(this);
- view = (LayoutPreference) findPreference(KEY_CACHE_SETTINGS);
// Cache section
- mCacheSize = (TextView) view.findViewById(R.id.cache_size_text);
- mClearCacheButton = (Button) view.findViewById(R.id.clear_cache_button)
+ mCacheSize = findPreference(KEY_CACHE_SIZE);
+ mClearCacheButton = (Button) ((LayoutPreference) findPreference(KEY_CLEAR_CACHE))
.findViewById(R.id.button);
mClearCacheButton.setText(R.string.clear_cache_btn_text);
}
@@ -192,10 +202,10 @@
|| mAppEntry.size == ApplicationsState.SIZE_UNKNOWN) {
mLastCodeSize = mLastDataSize = mLastCacheSize = mLastTotalSize = -1;
if (!mHaveSizes) {
- mAppSize.setText(mComputingStr);
- mDataSize.setText(mComputingStr);
- mCacheSize.setText(mComputingStr);
- mTotalSize.setText(mComputingStr);
+ mAppSize.setSummary(mComputingStr);
+ mDataSize.setSummary(mComputingStr);
+ mCacheSize.setSummary(mComputingStr);
+ mTotalSize.setSummary(mComputingStr);
}
mClearDataButton.setEnabled(false);
mClearCacheButton.setEnabled(false);
@@ -210,29 +220,29 @@
} else {
if (mLastExternalCodeSize != mAppEntry.externalCodeSize) {
mLastExternalCodeSize = mAppEntry.externalCodeSize;
- mExternalCodeSize.setText(getSizeStr(mAppEntry.externalCodeSize));
+ mExternalCodeSize.setSummary(getSizeStr(mAppEntry.externalCodeSize));
}
if (mLastExternalDataSize != mAppEntry.externalDataSize) {
mLastExternalDataSize = mAppEntry.externalDataSize;
- mExternalDataSize.setText(getSizeStr( mAppEntry.externalDataSize));
+ mExternalDataSize.setSummary(getSizeStr( mAppEntry.externalDataSize));
}
}
if (mLastCodeSize != codeSize) {
mLastCodeSize = codeSize;
- mAppSize.setText(getSizeStr(codeSize));
+ mAppSize.setSummary(getSizeStr(codeSize));
}
if (mLastDataSize != dataSize) {
mLastDataSize = dataSize;
- mDataSize.setText(getSizeStr(dataSize));
+ mDataSize.setSummary(getSizeStr(dataSize));
}
long cacheSize = mAppEntry.cacheSize + mAppEntry.externalCacheSize;
if (mLastCacheSize != cacheSize) {
mLastCacheSize = cacheSize;
- mCacheSize.setText(getSizeStr(cacheSize));
+ mCacheSize.setSummary(getSizeStr(cacheSize));
}
if (mLastTotalSize != mAppEntry.size) {
mLastTotalSize = mAppEntry.size;
- mTotalSize.setText(getSizeStr(mAppEntry.size));
+ mTotalSize.setSummary(getSizeStr(mAppEntry.size));
}
if ((mAppEntry.dataSize+ mAppEntry.externalDataSize) <= 0 || !mCanClearData) {
@@ -304,14 +314,18 @@
final List<VolumeInfo> candidates = context.getPackageManager()
.getPackageCandidateVolumes(mAppEntry.info);
- Collections.sort(candidates, VolumeInfo.getDescriptionComparator());
+ if (candidates.size() > 1) {
+ Collections.sort(candidates, VolumeInfo.getDescriptionComparator());
- mMoveDropDown.clearItems();
- for (VolumeInfo vol : candidates) {
- final String volDescrip = storage.getBestVolumeDescription(vol);
- mMoveDropDown.addItem(volDescrip, vol);
+ mMoveDropDown.clearItems();
+ for (VolumeInfo vol : candidates) {
+ final String volDescrip = storage.getBestVolumeDescription(vol);
+ mMoveDropDown.addItem(volDescrip, vol);
+ }
+ mMoveDropDown.setSelectable(!mAppControlRestricted);
+ } else {
+ removePreference(KEY_MOVE_PREFERENCE);
}
- mMoveDropDown.setSelectable(!mAppControlRestricted);
}
/*