Merge "Misc tweaks in settings" into oc-mr1-dev

This commit is contained in:
TreeHugger Robot
2017-08-04 20:16:36 +00:00
committed by Android (Google) Code Review
6 changed files with 25 additions and 46 deletions

View File

@@ -16,19 +16,31 @@
** limitations under the License.
*/
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:minHeight="?android:attr/listPreferredItemHeight"
android:padding="6dip">
<ImageView
android:id="@android:id/icon"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
<FrameLayout
android:id="@+id/icon_frame"
style="@style/preference_icon_frame"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:padding="6dip"
android:duplicateParentState="true"
/>
android:layout_height="wrap_content"
android:gravity="start|center_vertical"
android:paddingEnd="12dp"
android:paddingTop="4dp"
android:paddingBottom="4dp">
<android.support.v7.internal.widget.PreferenceImageView
android:id="@android:id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
settings:maxWidth="48dp"
settings:maxHeight="48dp" />
</FrameLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@@ -387,7 +387,7 @@
<string name="bluetooth_sap_acceptance_dialog_text"><xliff:g id="device_name">%1$s</xliff:g> wants to access your SIM card. Granting access to the SIM card will disable data connectivity on your device for the duration of the connection. Give access to <xliff:g id="device_name">%2$s?</xliff:g></string>
<!-- Description for bluetooth device name summary [CHAR LIMIT=none] -->
<string name="bluetooth_device_name_summary">Visible as \"<xliff:g id="device_name">^1</xliff:g>\" to other devices</string>
<string name="bluetooth_device_name_summary">Visible as \u201C<xliff:g id="device_name">^1</xliff:g>\u201D to other devices</string>
<!-- Title for paired device group [CHAR LIMIT=none] -->
<string name="bluetooth_paired_device_title">Your devices</string>
@@ -3143,13 +3143,7 @@
<!-- Master Clear -->
<!-- Button title to factory data reset the entire device -->
<string name="master_clear_title">Erase all data (Factory reset)</string>
<!-- Summary text for factory data reset describing what will be reset [CHAR_LIMIT=NONE]-->
<plurals name="master_clear_with_account_summary">
<item quantity="one">1 account will be reset</item>
<item quantity="other"><xliff:g id="account_count">%1$d</xliff:g> accounts will be reset</item>
</plurals>
<string name="master_clear_summary">Internal storage &amp; all data will be reset</string>
<string name="master_clear_title">Erase all data (factory reset)</string>
<!-- SD card & phone storage settings screen, message on screen after user selects Factory data reset [CHAR LIMIT=NONE] -->
<string name="master_clear_desc" product="tablet">"This will erase all data from your tablet\u2019s <b>internal storage</b>, including:\n\n<li>Your Google account</li>\n<li>System and app data and settings</li>\n<li>Downloaded apps</li>"</string>
<!-- SD card & phone storage settings screen, message on screen after user selects Factory data reset [CHAR LIMIT=NONE] -->

View File

@@ -38,7 +38,6 @@
<com.android.settingslib.RestrictedPreference
android:key="factory_reset"
android:title="@string/master_clear_title"
android:summary="@string/master_clear_summary"
settings:keywords="@string/keywords_factory_data_reset"
settings:userRestriction="no_factory_reset"
settings:useAdminDisabledSummary="true"

View File

@@ -48,6 +48,7 @@
<com.android.settingslib.RestrictedSwitchPreference
android:key="add_users_when_locked"
android:title="@string/user_add_on_lockscreen_menu"
android:singleLineTitle="false"
android:order="105"/>
<PreferenceCategory

View File

@@ -15,33 +15,24 @@
*/
package com.android.settings.system;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import android.content.pm.UserInfo;
import android.os.UserHandle;
import android.os.UserManager;
import android.support.v7.preference.Preference;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.core.AbstractPreferenceController;
import java.util.List;
public class FactoryResetPreferenceController extends AbstractPreferenceController
implements PreferenceControllerMixin {
/** Key of the "Factory reset" preference in {@link R.xml.reset_dashboard_fragment}. */
private static final String KEY_FACTORY_RESET = "factory_reset";
private final UserManager mUm;
private final AccountManager mAm;
public FactoryResetPreferenceController(Context context) {
super(context);
mUm = (UserManager) context.getSystemService(Context.USER_SERVICE);
mAm = (AccountManager) context.getSystemService(Context.ACCOUNT_SERVICE);
}
/** Hide "Factory reset" settings for secondary users, except demo users. */
@@ -54,22 +45,4 @@ public class FactoryResetPreferenceController extends AbstractPreferenceControll
public String getPreferenceKey() {
return KEY_FACTORY_RESET;
}
@Override
public void updateState(Preference preference) {
final List<UserInfo> profiles = mUm.getProfiles(UserHandle.myUserId());
int accountsCount = 0;
for (UserInfo userInfo : profiles) {
final int profileId = userInfo.id;
Account[] accounts = mAm.getAccountsAsUser(profileId);
accountsCount += accounts.length;
}
if (accountsCount == 0) {
preference.setSummary(R.string.master_clear_summary);
} else {
preference.setSummary(mContext.getResources().getQuantityString(
R.plurals.master_clear_with_account_summary,
accountsCount, accountsCount));
}
}
}

View File

@@ -74,7 +74,7 @@ public class BluetoothDeviceNamePreferenceControllerTest {
final CharSequence summary = mPreference.getSummary();
assertThat(summary.toString())
.isEqualTo("Visible as \"Nightshade\" to other devices");
.isEqualTo("Visible as \u201CNightshade\u201D to other devices");
assertThat(mPreference.isSelectable()).isFalse();
}