Merge "Add divider below summary text on A11y SUW hub. Bug: 27066012" into nyc-dev
diff --git a/res/layout/preference_list_fragment.xml b/res/layout/preference_list_fragment.xml
index 2621ada..9f1e076 100644
--- a/res/layout/preference_list_fragment.xml
+++ b/res/layout/preference_list_fragment.xml
@@ -67,10 +67,11 @@
</FrameLayout>
<TextView android:id="@android:id/empty"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="match_parent"
android:padding="@*android:dimen/preference_fragment_padding_side"
- android:gravity="center"
+ android:layout_gravity="center"
+ android:gravity="center_vertical"
android:visibility="gone" />
<include layout="@layout/admin_support_details_empty_view" />
diff --git a/res/layout/restricted_radio_with_summary.xml b/res/layout/restricted_radio_with_summary.xml
index 399d11d..55f158c 100644
--- a/res/layout/restricted_radio_with_summary.xml
+++ b/res/layout/restricted_radio_with_summary.xml
@@ -23,7 +23,7 @@
android:background="?android:attr/selectableItemBackground"
android:minHeight="?android:attr/listPreferredItemHeightSmall">
- <LinearLayout
+ <com.android.settings.CheckableLinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
@@ -47,7 +47,7 @@
android:src="@drawable/ic_info"
android:layout_marginLeft="@dimen/restricted_icon_padding"
android:visibility="gone" />
- </LinearLayout>
+ </com.android.settings.CheckableLinearLayout>
<TextView android:id="@android:id/summary"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 785dcb1..6418cba 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1005,7 +1005,7 @@
<string name="lock_settings_picker_title">Choose screen lock</string>
<!-- Title for security picker to choose the profile unlock method: None/Pattern/PIN/Password [CHAR LIMIT=22] -->
- <string name="lock_settings_picker_title_profile">Choose profile screen lock</string>
+ <string name="lock_settings_picker_title_profile">Choose work lock</string>
<!-- Title for security picker in setup wizard to choose the unlock method: None/Pattern/PIN/Password [CHAR LIMIT=22] -->
<string name="setup_lock_settings_picker_title">Protect your phone</string>
@@ -1029,15 +1029,15 @@
<!-- Profile Security lock settings --><skip />
<!-- Title for PreferenceScreen to launch picker for security method for the managed profile when there is none [CHAR LIMIT=22] -->
- <string name="unlock_set_unlock_launch_picker_title_profile">Profile screen lock</string>
+ <string name="unlock_set_unlock_launch_picker_title_profile">Work profile lock</string>
<!-- Title for PreferenceScreen to change security method: None/Pattern/PIN/Password [CHAR LIMIT=22] -->
<string name="unlock_set_unlock_launch_picker_change_title">Change lock screen</string>
- <!-- Summary for PreferenceScreen to changeecurity method: None/Pattern/PIN/Password [CHAR LIMIT=45] -->
+ <!-- Summary for PreferenceScreen to change security method: None/Pattern/PIN/Password [CHAR LIMIT=45] -->
<string name="unlock_set_unlock_launch_picker_change_summary">Change or disable pattern, PIN, or password security</string>
- <!-- Summary for PreferenceScreen to changeecurity method: None/Pattern/PIN/Password [CHAR LIMIT=45] -->
+ <!-- Summary for PreferenceScreen to change security method: None/Pattern/PIN/Password [CHAR LIMIT=45] -->
<string name="unlock_set_unlock_launch_picker_enable_summary">Choose a method to lock the screen</string>
<!-- Title for preference that disables unlock security [CHAR LIMIT=22] -->
@@ -2302,6 +2302,8 @@
<string name="status_imei">IMEI</string>
<!-- Do not translate. About phone, status item title -->
<string name="status_imei_sv">IMEI SV</string>
+ <!-- Do not translate. About phone, status item title -->
+ <string name="status_iccid">ICCID</string>
<!-- About tablet, status item title. The Mobile Directory Number [CHAR LIMIT=30] -->
<string name="status_number" product="tablet">MDN</string>
<!-- About phone, status item title. The phone number of the current device [CHAR LIMIT=30] -->
@@ -3085,15 +3087,15 @@
<!-- Message to be used to explain the user that he needs to enter his password to continue a
particular operation. [CHAR LIMIT=70]-->
<string name="lockpassword_confirm_your_password_generic">Enter your device password to continue.</string>
- <!-- Message to be used to explain the user that he needs to enter his profile pattern to continue a
+ <!-- Message to be used to explain the user that he needs to enter his work pattern to continue a
particular operation. [CHAR LIMIT=70]-->
- <string name="lockpassword_confirm_your_pattern_generic_profile">Use your profile pattern to continue.</string>
- <!-- Message to be used to explain the user that he needs to enter his profile PIN to continue a
+ <string name="lockpassword_confirm_your_pattern_generic_profile">Use your work pattern to continue.</string>
+ <!-- Message to be used to explain the user that he needs to enter his work PIN to continue a
particular operation. [CHAR LIMIT=70]-->
- <string name="lockpassword_confirm_your_pin_generic_profile">Enter your profile PIN to continue.</string>
- <!-- Message to be used to explain the user that he needs to enter his profile password to continue a
+ <string name="lockpassword_confirm_your_pin_generic_profile">Enter your work PIN to continue.</string>
+ <!-- Message to be used to explain the user that he needs to enter his work password to continue a
particular operation. [CHAR LIMIT=70]-->
- <string name="lockpassword_confirm_your_password_generic_profile">Enter your profile password to continue.</string>
+ <string name="lockpassword_confirm_your_password_generic_profile">Enter your work password to continue.</string>
<!-- Security & location settings screen, change security method screen instruction if user
enters incorrect PIN [CHAR LIMIT=30] -->
@@ -3163,21 +3165,21 @@
<!-- Profile Lock settings -->
<!-- Security & location settings screen, header for profile specific section -->
- <string name="lock_settings_profile_title">Work profile</string>
- <!-- Security & location settings screen, setting option name -->
- <string name="lock_settings_profile_label">Work profile security</string>
+ <string name="lock_settings_profile_title">Work profile security</string>
<!-- Security & location settings screen, title when changing or confirming the work profile lock -->
<string name="lock_settings_profile_screen_lock_title">Work profile screen lock</string>
<!-- Security & location settings screen, setting option name to unify work and personal locks -->
<string name="lock_settings_profile_unification_title">Use the same lock</string>
<!-- Security & location settings screen, setting option explanation to unify work and personal locks -->
- <string name="lock_settings_profile_unification_summary">Change device screen lock to match work profile?</string>
+ <string name="lock_settings_profile_unification_summary">Change device screen lock to match work profile</string>
<!-- Security & location settings screen, title of the dialog asking if the user wants to unify work and personal locks -->
- <string name="lock_settings_profile_unification_dialog_title">Use the same screen lock?</string>
+ <string name="lock_settings_profile_unification_dialog_title">Use the same lock?</string>
<!-- Security & location settings screen, explanation in the dialog asking if the user wants to unify work and personal locks -->
- <string name="lock_settings_profile_unification_dialog_body">You can use this lock for your device but it will include all screen lock related policies set by your IT admin on the work profile.\nDo you want to use the same screen lock for your device?</string>
+ <string name="lock_settings_profile_unification_dialog_body">You can use your work profile lock for your device screen lock as well. If you do, any work lock policies will also apply to your device screen lock.</string>
<!-- Security & location settings screen, explanation in the dialog asking if the user wants to create a new lock for personal and work as the current work lock is not enough for the device. -->
- <string name="lock_settings_profile_unification_dialog_uncompliant_body">Your work screen lock doesn\'t meet your organization\'s security requirements.\nYou can set a new screen lock for both your device and your work profile, but any work screen lock policies will apply to your device screen lock as well.</string>
+ <string name="lock_settings_profile_unification_dialog_uncompliant_body">Your work profile lock doesn\'t meet your organization\'s security requirements.\n\nYou can set a new screen lock for both your device and your work profile, but any work lock policies will apply to your device screen lock as well.</string>
+ <!-- Security & location settings screen, confirmation button of the dialog asking if the user wants to create a new lock for both personal and work profiles. -->
+ <string name="lock_settings_profile_unification_dialog_confirm">Change device lock</string>
<!-- Security & location settings screen, confirmation button of the dialog asking if the user wants to create a new lock for both personal and work profiles. -->
<string name="lock_settings_profile_unification_dialog_uncompliant_confirm">Change lock</string>
<!-- Security & location settings screen, summary of the item that changes your work profile lock when it is unified with the personal lock -->
@@ -5195,6 +5197,8 @@
<string name="vpn_menu_delete">Delete profile</string>
<!-- Menu item to select always-on VPN profile. [CHAR LIMIT=40] -->
<string name="vpn_menu_lockdown">Always-on VPN</string>
+ <!-- Placeholder when VPN settings is open but no VPNs have been created. [CHAR LIMIT=100] -->
+ <string name="vpn_no_vpns_added">No VPNs added.</string>
<!-- Summary describing the always-on VPN feature. [CHAR LIMIT=NONE] -->
<string name="vpn_lockdown_summary">Select a VPN profile to always remain connected to. Network traffic will only be allowed when connected to this VPN.</string>
@@ -5934,18 +5938,18 @@
<string name="lock_screen_notifications_interstitial_title">Notifications</string>
<!-- Configure Notifications: Value for lockscreen notifications: all information will be
- shown in profile notifications shown on a secure lock screen
+ shown in work notifications shown on a secure lock screen
[CHAR LIMIT=50] -->
- <string name="lock_screen_notifications_summary_show_profile">Show all profile notification content</string>
+ <string name="lock_screen_notifications_summary_show_profile">Show all work notification content</string>
<!-- Configure Notifications: Value for lockscreen notifications: sensitive information will be
- hidden or redacted from profile notifications shown on a secure lock screen
+ hidden or redacted from work notifications shown on a secure lock screen
[CHAR LIMIT=50] -->
- <string name="lock_screen_notifications_summary_hide_profile">Hide sensitive profile notification content</string>
+ <string name="lock_screen_notifications_summary_hide_profile">Hide sensitive work notification content</string>
- <!-- Configure Notifications: Value for lockscreen notifications: profile notifications will not appear on a secure lock screen
+ <!-- Configure Notifications: Value for lockscreen notifications: work notifications will not appear on a secure lock screen
[CHAR LIMIT=50] -->
- <string name="lock_screen_notifications_summary_disable_profile">Don\u2019t show profile notifications at all</string>
+ <string name="lock_screen_notifications_summary_disable_profile">Don\u2019t show work notifications at all</string>
<!-- Security > Choose PIN/PW/Pattern > Notification redaction interstitial: Message asking the user how they want their profile notifications to appear when the device is locked [CHAR LIMIT=NONE] -->
<string name="lock_screen_notifications_interstitial_message_profile">When your device is locked, how do you want profile notifications to show?</string>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index ffc421d..7a02ea9 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -286,6 +286,7 @@
</style>
<style name="Theme.ConfirmDeviceCredentialsWork" parent="Theme.ConfirmDeviceCredentialsDark">
<item name="@*android:regularColor">@*android:color/white</item>
+ <item name="android:colorAccent">@*android:color/white</item>
</style>
<style name="Theme.FingerprintEnroll" parent="@*android:style/Theme.Material.Settings.NoActionBar">
@@ -295,6 +296,7 @@
<item name="android:textAppearanceListItemSmall">@android:style/TextAppearance.Material.Body1</item>
<item name="android:windowAnimationStyle">@style/Animation.SuwWindowAnimation</item>
+ <item name="suwDividerCondition">both</item>
<item name="suwListItemIconColor">?android:attr/colorAccent</item>
<item name="suwMarginSides">@dimen/suw_layout_margin_sides</item>
</style>
diff --git a/res/xml/device_info_sim_status.xml b/res/xml/device_info_sim_status.xml
index 71fd5c6..aa8896c 100644
--- a/res/xml/device_info_sim_status.xml
+++ b/res/xml/device_info_sim_status.xml
@@ -87,4 +87,11 @@
android:summary="@string/device_info_not_available"
android:persistent="false" />
+ <Preference android:key="iccid"
+ android:enabled="false"
+ android:shouldDisableView="false"
+ android:title="@string/status_iccid"
+ android:summary="@string/device_info_not_available"
+ android:persistent="false" />
+
</PreferenceScreen>
diff --git a/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java b/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java
index b9836d1..42279fd 100644
--- a/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java
+++ b/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java
@@ -137,17 +137,12 @@
if (intent != null) {
CharSequence titleText = intent.getCharSequenceExtra(
ConfirmDeviceCredentialBaseFragment.TITLE_TEXT);
- if (titleText == null && supplementalText == null) {
+ if (titleText == null || supplementalText == null) {
return;
}
- StringBuilder builder = new StringBuilder();
- if (titleText != null) {
- builder.append(titleText).append(",");
- }
- if (supplementalText != null) {
- builder.append(supplementalText);
- }
- getActivity().setTitle(Utils.createAccessibleSequence(titleText, builder.toString()));
+ String accessibilityTitle =
+ new StringBuilder(titleText).append(",").append(supplementalText).toString();
+ getActivity().setTitle(Utils.createAccessibleSequence(titleText, accessibilityTitle));
}
}
diff --git a/src/com/android/settings/PrivacySettings.java b/src/com/android/settings/PrivacySettings.java
index 03e569b..7732837 100644
--- a/src/com/android/settings/PrivacySettings.java
+++ b/src/com/android/settings/PrivacySettings.java
@@ -21,6 +21,8 @@
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -155,9 +157,11 @@
try {
backupEnabled = mBackupManager.isBackupEnabled();
String transport = mBackupManager.getCurrentTransport();
- configIntent = mBackupManager.getConfigurationIntent(transport);
+ configIntent = validatedActivityIntent(
+ mBackupManager.getConfigurationIntent(transport), "config");
configSummary = mBackupManager.getDestinationString(transport);
- manageIntent = mBackupManager.getDataManagementIntent(transport);
+ manageIntent = validatedActivityIntent(
+ mBackupManager.getDataManagementIntent(transport), "management");
manageLabel = mBackupManager.getDataManagementLabel(transport);
mBackup.setSummary(backupEnabled
@@ -189,6 +193,19 @@
}
}
+ private Intent validatedActivityIntent(Intent intent, String logLabel) {
+ if (intent != null) {
+ PackageManager pm = getPackageManager();
+ List<ResolveInfo> resolved = pm.queryIntentActivities(intent, 0);
+ if (resolved == null || resolved.isEmpty()) {
+ intent = null;
+ Log.e(TAG, "Backup " + logLabel + " intent " + intent
+ + " fails to resolve; ignoring");
+ }
+ }
+ return intent;
+ }
+
private void setConfigureSummary(String summary) {
if (summary != null) {
mConfigure.setSummary(summary);
diff --git a/src/com/android/settings/RestrictedSettingsFragment.java b/src/com/android/settings/RestrictedSettingsFragment.java
index 0f2c033..711ef8f 100644
--- a/src/com/android/settings/RestrictedSettingsFragment.java
+++ b/src/com/android/settings/RestrictedSettingsFragment.java
@@ -209,7 +209,6 @@
protected TextView initEmptyTextView() {
TextView emptyView = (TextView) getActivity().findViewById(android.R.id.empty);
- emptyView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
return emptyView;
}
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index c6ec4a9..4097d04 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -29,7 +29,6 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
-import android.content.pm.UserInfo;
import android.content.res.Resources;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
@@ -53,10 +52,8 @@
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
-
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.internal.widget.LockPatternUtils;
-import com.android.settings.TimeoutListPreference;
import com.android.settings.TrustAgentUtils.TrustAgentComponentInfo;
import com.android.settings.fingerprint.FingerprintSettings;
import com.android.settings.search.BaseSearchIndexProvider;
@@ -71,7 +68,6 @@
import java.util.List;
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
-
import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
/**
@@ -212,6 +208,14 @@
return resid;
}
+ @Override
+ public void setPreferenceScreen(PreferenceScreen preferenceScreen) {
+ if (!preferenceScreen.isAttached()) {
+ preferenceScreen.setShouldUseGeneratedIds(false);
+ }
+ super.setPreferenceScreen(preferenceScreen);
+ }
+
/**
* Important!
*
diff --git a/src/com/android/settings/dashboard/DashboardSummary.java b/src/com/android/settings/dashboard/DashboardSummary.java
index 69fd8e7..448a77d 100644
--- a/src/com/android/settings/dashboard/DashboardSummary.java
+++ b/src/com/android/settings/dashboard/DashboardSummary.java
@@ -58,11 +58,14 @@
private static final String SUGGESTIONS = "suggestions";
+ private static final String EXTRA_SCROLL_POSITION = "scroll_position";
+
private FocusRecyclerView mDashboard;
private DashboardAdapter mAdapter;
private SummaryLoader mSummaryLoader;
private ConditionManager mConditionManager;
private SuggestionParser mSuggestionParser;
+ private LinearLayoutManager mLayoutManager;
@Override
protected int getMetricsCategory() {
@@ -134,16 +137,27 @@
}
@Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putInt(EXTRA_SCROLL_POSITION, mLayoutManager.findFirstVisibleItemPosition());
+ }
+
+ @Override
public void onViewCreated(View view, Bundle bundle) {
mDashboard = (FocusRecyclerView) view.findViewById(R.id.dashboard_container);
- LinearLayoutManager llm = new LinearLayoutManager(getContext());
- llm.setOrientation(LinearLayoutManager.VERTICAL);
- mDashboard.setLayoutManager(llm);
+ mLayoutManager = new LinearLayoutManager(getContext());
+ mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
+ if (bundle != null) {
+ int scrollPosition = bundle.getInt(EXTRA_SCROLL_POSITION);
+ mLayoutManager.scrollToPosition(scrollPosition);
+ }
+ mDashboard.setLayoutManager(mLayoutManager);
mDashboard.setHasFixedSize(true);
mDashboard.setListener(this);
mAdapter = new DashboardAdapter(getContext());
mAdapter.setConditions(mConditionManager.getConditions());
mAdapter.setSuggestions(mSuggestionParser);
+ mDashboard.setAdapter(mAdapter);
mSummaryLoader.setAdapter(mAdapter);
ConditionAdapterUtils.addDismiss(mDashboard);
@@ -164,7 +178,6 @@
// recheck to see if any suggestions have been changed.
mAdapter.setSuggestions(mSuggestionParser);
- mDashboard.setAdapter(mAdapter);
long delta = System.currentTimeMillis() - start;
Log.d(TAG, "rebuildUI took: " + delta + " ms");
diff --git a/src/com/android/settings/dashboard/conditional/ConditionAdapterUtils.java b/src/com/android/settings/dashboard/conditional/ConditionAdapterUtils.java
index 571b6b5..b64a595 100644
--- a/src/com/android/settings/dashboard/conditional/ConditionAdapterUtils.java
+++ b/src/com/android/settings/dashboard/conditional/ConditionAdapterUtils.java
@@ -61,8 +61,9 @@
public static void bindViews(final Condition condition,
DashboardAdapter.DashboardItemHolder view, boolean isExpanded,
View.OnClickListener onClickListener, View.OnClickListener onExpandListener) {
- view.itemView.setTag(condition);
- view.itemView.setOnClickListener(onClickListener);
+ View card = view.itemView.findViewById(R.id.content);
+ card.setTag(condition);
+ card.setOnClickListener(onClickListener);
view.icon.setImageIcon(condition.getIcon());
view.title.setText(condition.getTitle());
ImageView expand = (ImageView) view.itemView.findViewById(R.id.expand_indicator);
diff --git a/src/com/android/settings/deviceinfo/SimStatus.java b/src/com/android/settings/deviceinfo/SimStatus.java
index 68d77af..80dfc58 100644
--- a/src/com/android/settings/deviceinfo/SimStatus.java
+++ b/src/com/android/settings/deviceinfo/SimStatus.java
@@ -23,6 +23,7 @@
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.os.Bundle;
+import android.os.PersistableBundle;
import android.os.UserHandle;
import android.os.UserManager;
import android.support.v7.preference.Preference;
@@ -34,6 +35,7 @@
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
+import android.telephony.CarrierConfigManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
@@ -78,6 +80,7 @@
private static final String KEY_SIGNAL_STRENGTH = "signal_strength";
private static final String KEY_IMEI = "imei";
private static final String KEY_IMEI_SV = "imei_sv";
+ private static final String KEY_ICCID = "iccid";
private static final String COUNTRY_ABBREVIATION_BRAZIL = "br";
static final String CB_AREA_INFO_RECEIVED_ACTION =
@@ -92,11 +95,13 @@
private TelephonyManager mTelephonyManager;
+ private CarrierConfigManager mCarrierConfigManager;
private Phone mPhone = null;
private Resources mRes;
private Preference mSignalStrength;
private SubscriptionInfo mSir;
private boolean mShowLatestAreaInfo;
+ private boolean mShowICCID;
// Default summary for items
private String mDefaultText;
@@ -129,6 +134,7 @@
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
mTelephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
+ mCarrierConfigManager = (CarrierConfigManager) getSystemService(CARRIER_CONFIG_SERVICE);
mSelectableSubInfos = SubscriptionManager.from(this).getActiveSubscriptionInfoList();
@@ -356,6 +362,10 @@
mShowLatestAreaInfo = true;
}
}
+ PersistableBundle carrierConfig = mCarrierConfigManager.getConfig(
+ mSir.getSubscriptionId());
+ mShowICCID = carrierConfig.getBoolean(
+ CarrierConfigManager.KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL);
String rawNumber = mTelephonyManager.getLine1Number(mSir.getSubscriptionId());
String formattedNumber = null;
@@ -367,6 +377,14 @@
setSummaryText(KEY_IMEI, mPhone.getImei());
setSummaryText(KEY_IMEI_SV, mPhone.getDeviceSvn());
+ if (!mShowICCID) {
+ removePreferenceFromScreen(KEY_ICCID);
+ } else {
+ // Get ICCID, which is SIM serial number
+ String iccid = mTelephonyManager.getSimSerialNumber(mSir.getSubscriptionId());
+ setSummaryText(KEY_ICCID, iccid);
+ }
+
if (!mShowLatestAreaInfo) {
removePreferenceFromScreen(KEY_LATEST_AREA_INFO);
}
diff --git a/src/com/android/settings/fuelgauge/BatteryHistoryDetail.java b/src/com/android/settings/fuelgauge/BatteryHistoryDetail.java
index b2cb73a..25d5292 100644
--- a/src/com/android/settings/fuelgauge/BatteryHistoryDetail.java
+++ b/src/com/android/settings/fuelgauge/BatteryHistoryDetail.java
@@ -28,13 +28,13 @@
import android.widget.TextView;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.internal.os.BatteryStatsHelper;
-import com.android.settings.InstrumentedFragment;
import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.fuelgauge.BatteryActiveView.BatteryActiveProvider;
import com.android.settingslib.BatteryInfo;
import com.android.settingslib.graph.UsageView;
-public class BatteryHistoryDetail extends InstrumentedFragment {
+public class BatteryHistoryDetail extends SettingsPreferenceFragment {
public static final String EXTRA_STATS = "stats";
public static final String EXTRA_BROADCAST = "broadcast";
diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
index bc44eeb..1712734 100644
--- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java
+++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java
@@ -28,6 +28,7 @@
import android.os.UserHandle;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceGroup;
+import android.text.TextUtils;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.Menu;
@@ -167,9 +168,14 @@
}
private void addNotAvailableMessage() {
- Preference notAvailable = new Preference(getPrefContext());
- notAvailable.setTitle(R.string.power_usage_not_available);
- mAppListGroup.addPreference(notAvailable);
+ final String NOT_AVAILABLE = "not_available";
+ Preference notAvailable = getCachedPreference(NOT_AVAILABLE);
+ if (notAvailable == null) {
+ notAvailable = new Preference(getPrefContext());
+ notAvailable.setKey(NOT_AVAILABLE);
+ notAvailable.setTitle(R.string.power_usage_not_available);
+ mAppListGroup.addPreference(notAvailable);
+ }
}
private static boolean isSharedGid(int uid) {
@@ -274,7 +280,7 @@
super.refreshStats();
PowerWhitelistBackend powerWhiteist = PowerWhitelistBackend.getInstance();
updatePreference(mHistPref);
- mAppListGroup.removeAll();
+ cacheRemoveAllPrefs(mAppListGroup);
mAppListGroup.setOrderingAsAdded(false);
boolean addedSome = false;
@@ -336,8 +342,16 @@
userHandle);
final CharSequence contentDescription = mUm.getBadgedLabelForUser(entry.getLabel(),
userHandle);
- final PowerGaugePreference pref = new PowerGaugePreference(getPrefContext(),
- badgedIcon, contentDescription, entry);
+ final String key = sipper.drainType == DrainType.APP ? sipper.getPackages() != null
+ ? TextUtils.concat(sipper.getPackages()).toString()
+ : String.valueOf(sipper.getUid())
+ : sipper.drainType.toString();
+ PowerGaugePreference pref = (PowerGaugePreference) getCachedPreference(key);
+ if (pref == null) {
+ pref = new PowerGaugePreference(getPrefContext(), badgedIcon,
+ contentDescription, entry);
+ pref.setKey(key);
+ }
final double percentOfMax = (sipper.totalPowerMah * 100)
/ mStatsHelper.getMaxPower();
@@ -368,6 +382,7 @@
if (!addedSome) {
addNotAvailableMessage();
}
+ removeCachedPrefs(mAppListGroup);
BatteryEntry.startRequestQueue();
}
diff --git a/src/com/android/settings/inputmethod/InputMethodSettingValuesWrapper.java b/src/com/android/settings/inputmethod/InputMethodSettingValuesWrapper.java
index c4c889d..e694573 100644
--- a/src/com/android/settings/inputmethod/InputMethodSettingValuesWrapper.java
+++ b/src/com/android/settings/inputmethod/InputMethodSettingValuesWrapper.java
@@ -73,7 +73,7 @@
// Ensure singleton
private InputMethodSettingValuesWrapper(Context context) {
mSettings = new InputMethodSettings(context.getResources(), context.getContentResolver(),
- mMethodMap, mMethodList, getDefaultCurrentUserId());
+ mMethodMap, mMethodList, getDefaultCurrentUserId(), false /* copyOnWrite */);
mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
refreshAllInputMethodAndSubtypes();
}
diff --git a/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java b/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java
index e6254ad..80870b4 100644
--- a/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java
+++ b/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java
@@ -79,7 +79,8 @@
getContentResolver(),
new HashMap<String, InputMethodInfo>(),
new ArrayList<InputMethodInfo>(),
- USER_SYSTEM);
+ USER_SYSTEM,
+ false /* copyOnWrite */);
mKeyboardAssistanceCategory = Preconditions.checkNotNull(
(PreferenceCategory) findPreference(KEYBOARD_ASSISTANCE_CATEGORY));
mShowVirtualKeyboardSwitch = Preconditions.checkNotNull(
diff --git a/src/com/android/settings/vpn2/VpnSettings.java b/src/com/android/settings/vpn2/VpnSettings.java
index 6f56b06..e5a78b6 100644
--- a/src/com/android/settings/vpn2/VpnSettings.java
+++ b/src/com/android/settings/vpn2/VpnSettings.java
@@ -111,20 +111,15 @@
}
@Override
- public void onCreate(Bundle savedState) {
- super.onCreate(savedState);
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
mUserManager = (UserManager) getSystemService(Context.USER_SERVICE);
- if (isUiRestricted()) {
- mUnavailable = true;
- setPreferenceScreen(new PreferenceScreen(getPrefContext(), null));
- setHasOptionsMenu(false);
- return;
- }
-
mConnectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
- setHasOptionsMenu(true);
+ mUnavailable = isUiRestricted();
+ setHasOptionsMenu(!mUnavailable);
+
addPreferencesFromResource(R.xml.vpn_settings2);
}
@@ -186,6 +181,8 @@
}
getPreferenceScreen().removeAll();
return;
+ } else {
+ getEmptyTextView().setText(R.string.vpn_no_vpns_added);
}
final boolean pickLockdown = getActivity()
@@ -225,6 +222,7 @@
public boolean handleMessage(Message message) {
mUpdater.removeMessages(RESCAN_MESSAGE);
+ // Run heavy RPCs before switching to UI thread
final List<VpnProfile> vpnProfiles = loadVpnProfiles(mKeyStore);
final List<AppVpnInfo> vpnApps = getVpnApps(getActivity(), /* includeProfiles */ true);
@@ -233,10 +231,15 @@
final Set<Integer> readOnlyUsers = getReadOnlyUserProfiles();
- // Refresh the PreferenceGroup which lists VPNs
+ // Refresh list of VPNs
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
+ // Can't do anything useful if the context has gone away
+ if (!isAdded()) {
+ return;
+ }
+
// Find new VPNs by subtracting existing ones from the full set
final Set<Preference> updates = new ArraySet<>();