Merge "Introduce InteractionJankMonitor into Settings" into sc-dev
diff --git a/res/layout/device_admin_add.xml b/res/layout/device_admin_add.xml
index 493f22c..3ca8d02 100644
--- a/res/layout/device_admin_add.xml
+++ b/res/layout/device_admin_add.xml
@@ -4,9 +4,9 @@
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.
@@ -21,7 +21,7 @@
android:layout_height="match_parent"
android:orientation="vertical">
- <ScrollView
+ <androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1.0"
@@ -173,5 +173,5 @@
</LinearLayout>
</LinearLayout>
- </ScrollView>
+ </androidx.core.widget.NestedScrollView>
</LinearLayout>
diff --git a/res/layout/restricted_preference_dropdown.xml b/res/layout/restricted_preference_dropdown.xml
index 86053bf..8930e24 100644
--- a/res/layout/restricted_preference_dropdown.xml
+++ b/res/layout/restricted_preference_dropdown.xml
@@ -26,6 +26,6 @@
android:visibility="invisible"
android:layout_marginStart="@dimen/preference_no_icon_padding_start"/>
- <include layout="@layout/preference_material" />
+ <include layout="@layout/settingslib_preference" />
</FrameLayout>
\ No newline at end of file
diff --git a/res/layout/running_processes_item.xml b/res/layout/running_processes_item.xml
index 2bca90e..6b8547a 100644
--- a/res/layout/running_processes_item.xml
+++ b/res/layout/running_processes_item.xml
@@ -31,5 +31,5 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toStartOf="@id/widget_summary"
- layout="@layout/preference_material"/>
+ layout="@layout/preference_app"/>
</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout/storage_item.xml b/res/layout/storage_item.xml
index 6de2d510..40796f7 100644
--- a/res/layout/storage_item.xml
+++ b/res/layout/storage_item.xml
@@ -35,22 +35,7 @@
android:clipToPadding="false"
android:paddingStart="?android:attr/listPreferredItemPaddingStart">
- <LinearLayout
- android:id="@+id/icon_frame"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="start|center_vertical"
- android:minWidth="56dp"
- android:orientation="horizontal"
- android:paddingTop="4dp"
- android:paddingBottom="4dp">
- <com.android.internal.widget.PreferenceImageView
- android:id="@android:id/icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:maxWidth="24dp"
- android:maxHeight="24dp"/>
- </LinearLayout>
+ <include layout="@layout/settingslib_icon_frame"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0f7651a..1c5f833 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -13143,8 +13143,8 @@
<string name="to_switch_networks_disconnect_ethernet">To switch networks, disconnect ethernet</string>
<!-- Panel subtitle for Wi-Fi turned on. [CHAR LIMIT=60] -->
<string name="wifi_is_turned_on_subtitle">Wi\u2011Fi is turned on</string>
- <!-- Panel subtitle for select the network you want to use for data. [CHAR LIMIT=60] -->
- <string name="select_network_to_connect_internet">Select the network you want to use for data</string>
+ <!-- Panel subtitle for tapping a network to connect to internet. [CHAR LIMIT=60] -->
+ <string name="tap_a_network_to_connect">Tap a network to connect</string>
<!-- Title for merged carrier Wi-Fi offload toggle. [CHAR LIMIT=NONE] -->
<string name="carrier_wifi_offload_title">W+ connections</string>
<!-- Summary for merged carrier Wi-Fi offload toggle. [CHAR LIMIT=NONE] -->
diff --git a/res/values/styles_preference.xml b/res/values/styles_preference.xml
index 42ed0e9..ea2900f 100644
--- a/res/values/styles_preference.xml
+++ b/res/values/styles_preference.xml
@@ -59,6 +59,7 @@
<style name="SettingsMultiSelectListPreference" parent="@style/Preference.Material">
<item name="android:positiveButtonText">@android:string/ok</item>
<item name="android:negativeButtonText">@android:string/cancel</item>
+ <item name="iconSpaceReserved">@bool/settingslib_config_icon_space_reserved</item>
</style>
<style name="SettingsPreferenceFragmentStyle" parent="@style/PreferenceFragment.Material">
diff --git a/res/xml/app_info_settings_v2.xml b/res/xml/app_info_settings_v2.xml
index 8b9cf4f..b4a82e0 100644
--- a/res/xml/app_info_settings_v2.xml
+++ b/res/xml/app_info_settings_v2.xml
@@ -24,27 +24,18 @@
android:key="header_view"
android:layout="@layout/settings_entity_header"
android:selectable="false"
- android:order="-10000"
- settings:allowDividerBelow="true"/>
+ android:order="-10000" />
<com.android.settingslib.widget.LayoutPreference
android:key="instant_app_buttons"
android:layout="@layout/instant_app_buttons"
android:selectable="false"
- android:order="-9999"
- settings:allowDividerAbove="true"
- settings:allowDividerBelow="true"/>
+ android:order="-9999" />
<com.android.settingslib.widget.ActionButtonsPreference
android:key="action_buttons"
android:order="-9998" />
- <!-- Add SpacePreference to draw divider -->
- <com.android.settings.applications.SpacePreference
- android:layout_height="0dp"
- android:order="-9997"
- settings:allowDividerAbove="true" />
-
<Preference
android:key="app_settings_link"
android:title="@string/app_settings_link"
diff --git a/res/xml/app_storage_settings.xml b/res/xml/app_storage_settings.xml
index 6092dbb..6ffc375 100644
--- a/res/xml/app_storage_settings.xml
+++ b/res/xml/app_storage_settings.xml
@@ -22,11 +22,6 @@
<com.android.settingslib.widget.ActionButtonsPreference
android:key="header_view" />
- <com.android.settings.applications.SpacePreference
- android:key="storage_space"
- android:layout_height="8dp"
- settings:allowDividerAbove="true"/>
-
<Preference
android:key="storage_used"
android:title="@string/storage_used"
@@ -41,8 +36,7 @@
<PreferenceCategory
android:key="storage_category"
- android:title="@string/app_info_storage_title"
- settings:allowDividerAbove="true">
+ android:title="@string/app_info_storage_title">
<Preference
android:key="app_size"
diff --git a/res/xml/mobile_network_settings.xml b/res/xml/mobile_network_settings.xml
index 8588f8b..0ec1a61 100644
--- a/res/xml/mobile_network_settings.xml
+++ b/res/xml/mobile_network_settings.xml
@@ -163,7 +163,7 @@
android:title="@string/call_category"
settings:controller="com.android.settings.network.telephony.CallingPreferenceCategoryController">
- <PreferenceScreen
+ <Preference
android:key="wifi_calling"
android:title="@string/wifi_calling_settings_title"
android:summary="@string/wifi_calling_summary"
@@ -173,7 +173,7 @@
android:targetClass="com.android.settings.Settings$WifiCallingSettingsActivity">
<extra android:name="show_drawer_menu" android:value="true"/>
</intent>
- </PreferenceScreen>
+ </Preference>
<SwitchPreference
android:key="video_calling_key"
diff --git a/src/com/android/settings/applications/intentpicker/VerifiedLinksPreference.java b/src/com/android/settings/applications/intentpicker/VerifiedLinksPreference.java
index 5452a2a..fdfe215 100644
--- a/src/com/android/settings/applications/intentpicker/VerifiedLinksPreference.java
+++ b/src/com/android/settings/applications/intentpicker/VerifiedLinksPreference.java
@@ -89,7 +89,7 @@
CheckBox checkBox = (CheckBox) view.findViewById(com.android.internal.R.id.checkbox);
if (checkBox != null) {
checkBox.setChecked(true);
- checkBox.setVisibility(mShowCheckBox ? View.VISIBLE : View.INVISIBLE);
+ checkboxContainer.setVisibility(mShowCheckBox ? View.VISIBLE : View.GONE);
}
}
}
diff --git a/src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java b/src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java
index b072047..e5e9b7d 100644
--- a/src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java
+++ b/src/com/android/settings/applications/manageapplications/ApplicationViewHolder.java
@@ -19,6 +19,7 @@
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
+import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -37,9 +38,8 @@
public class ApplicationViewHolder extends RecyclerView.ViewHolder {
- private final TextView mAppName;
- private final ImageView mAppIcon;
-
+ @VisibleForTesting
+ final TextView mAppName;
@VisibleForTesting
final TextView mSummary;
@VisibleForTesting
@@ -49,6 +49,8 @@
@VisibleForTesting
final Switch mSwitch;
+ private final ImageView mAppIcon;
+
ApplicationViewHolder(View itemView) {
super(itemView);
mAppName = itemView.findViewById(android.R.id.title);
@@ -95,11 +97,16 @@
itemView.setEnabled(isEnabled);
}
- void setTitle(CharSequence title) {
+ void setTitle(CharSequence title, CharSequence contentDescription) {
if (title == null) {
return;
}
mAppName.setText(title);
+
+ if (TextUtils.isEmpty(contentDescription)) {
+ return;
+ }
+ mAppName.setContentDescription(contentDescription);
}
void setIcon(int drawableRes) {
diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java
index 7469b71..d5162a85 100644
--- a/src/com/android/settings/applications/manageapplications/ManageApplications.java
+++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java
@@ -1422,9 +1422,8 @@
// Bind the data efficiently with the holder
final ApplicationsState.AppEntry entry = mEntries.get(position);
synchronized (entry) {
- holder.setTitle(entry.label);
mState.ensureLabelDescription(entry);
- holder.itemView.setContentDescription(entry.labelDescription);
+ holder.setTitle(entry.label, entry.labelDescription);
mState.ensureIcon(entry);
holder.setIcon(entry.icon);
updateSummary(holder, entry);
diff --git a/src/com/android/settings/deviceinfo/storage/StorageEntry.java b/src/com/android/settings/deviceinfo/storage/StorageEntry.java
index f718116..b419370 100644
--- a/src/com/android/settings/deviceinfo/storage/StorageEntry.java
+++ b/src/com/android/settings/deviceinfo/storage/StorageEntry.java
@@ -26,6 +26,8 @@
import android.os.storage.VolumeRecord;
import android.text.TextUtils;
+import com.android.settings.R;
+
import java.io.File;
/**
@@ -44,8 +46,15 @@
mVolumeInfo = volumeInfo;
mUnsupportedDiskInfo = null;
mMissingVolumeRecord = null;
- mVolumeInfoDescription = context.getSystemService(StorageManager.class)
- .getBestVolumeDescription(mVolumeInfo);
+
+ if (isDefaultInternalStorage()) {
+ // Shows "This device" for default internal storage.
+ mVolumeInfoDescription = context.getResources()
+ .getString(R.string.storage_default_internal_storage);
+ } else {
+ mVolumeInfoDescription = context.getSystemService(StorageManager.class)
+ .getBestVolumeDescription(mVolumeInfo);
+ }
}
public StorageEntry(@NonNull DiskInfo diskInfo) {
diff --git a/src/com/android/settings/panel/InternetConnectivityPanel.java b/src/com/android/settings/panel/InternetConnectivityPanel.java
index 50371ae..a6c18a5 100644
--- a/src/com/android/settings/panel/InternetConnectivityPanel.java
+++ b/src/com/android/settings/panel/InternetConnectivityPanel.java
@@ -65,8 +65,8 @@
private static final String TAG = "InternetConnectivityPanel";
private static final int SUBTITLE_TEXT_NONE = -1;
private static final int SUBTITLE_TEXT_WIFI_IS_TURNED_ON = R.string.wifi_is_turned_on_subtitle;
- private static final int SUBTITLE_TEXT_SELECT_NETWORK_TO_CONNECT_INTERNET =
- R.string.select_network_to_connect_internet;
+ private static final int SUBTITLE_TEXT_TAP_A_NETWORK_TO_CONNECT =
+ R.string.tap_a_network_to_connect;
private static final int SUBTITLE_TEXT_SEARCHING_FOR_NETWORKS =
R.string.wifi_empty_list_wifi_on;
private static final int SUBTITLE_TEXT_NON_CARRIER_NETWORK_UNAVAILABLE =
@@ -326,7 +326,7 @@
if (wifiList != null && wifiList.size() != 0) {
// When the Wi-Fi scan result is not empty
// Sub-Title: Select the network you want to use for data
- mSubtitle = SUBTITLE_TEXT_SELECT_NETWORK_TO_CONNECT_INTERNET;
+ mSubtitle = SUBTITLE_TEXT_TAP_A_NETWORK_TO_CONNECT;
return;
}
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/ApplicationViewHolderTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/ApplicationViewHolderTest.java
index c3ae904..83d74a7 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/ApplicationViewHolderTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/ApplicationViewHolderTest.java
@@ -70,6 +70,22 @@
}
@Test
+ public void setTitle_titleIsNotEmptyAndContentIsNotEmpty_shouldSetTitleAndContentDescription() {
+ mHolder.setTitle("title", "content");
+
+ assertThat(mHolder.mAppName).isEqualTo("title");
+ assertThat(mHolder.mAppName.getContentDescription()).isEqualTo("content");
+ }
+
+ @Test
+ public void setTitle_titleIsNotEmptyButContentIsEmpty_shouldSetTitle() {
+ mHolder.setTitle("title", "");
+
+ assertThat(mHolder.mAppName).isEqualTo("title");
+ assertThat(mHolder.mAppName.getContentDescription()).isEqualTo("title");
+ }
+
+ @Test
public void updateSize() {
final String invalidStr = "invalid";
final ApplicationsState.AppEntry entry = mock(ApplicationsState.AppEntry.class);
diff --git a/tests/unit/src/com/android/settings/deviceinfo/storage/StorageEntryTest.java b/tests/unit/src/com/android/settings/deviceinfo/storage/StorageEntryTest.java
index c2591a7..7541e93 100644
--- a/tests/unit/src/com/android/settings/deviceinfo/storage/StorageEntryTest.java
+++ b/tests/unit/src/com/android/settings/deviceinfo/storage/StorageEntryTest.java
@@ -31,6 +31,8 @@
import androidx.test.core.app.ApplicationProvider;
import androidx.test.runner.AndroidJUnit4;
+import com.android.settings.testutils.ResourcesUtils;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -247,6 +249,17 @@
}
@Test
+ public void getDescription_defaultInternalStorage_returnThisDevice() {
+ final VolumeInfo volumeInfo = mock(VolumeInfo.class);
+ when(volumeInfo.getType()).thenReturn(VolumeInfo.TYPE_PRIVATE);
+ when(volumeInfo.getId()).thenReturn(VolumeInfo.ID_PRIVATE_INTERNAL);
+ final StorageEntry volumeStorage = new StorageEntry(mContext, volumeInfo);
+
+ assertThat(volumeStorage.getDescription()).isEqualTo(
+ ResourcesUtils.getResourcesString(mContext, "storage_default_internal_storage"));
+ }
+
+ @Test
public void getDiskId_shouldReturnDiskId() {
final VolumeInfo volumeInfo = mock(VolumeInfo.class);
final StorageEntry volumeStorage = new StorageEntry(mContext, volumeInfo);
diff --git a/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java b/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java
index 651eb04..150c99e 100644
--- a/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java
+++ b/tests/unit/src/com/android/settings/panel/InternetConnectivityPanelTest.java
@@ -63,10 +63,9 @@
ApplicationProvider.getApplicationContext(), "airplane_mode");
public static final String SUBTITLE_WIFI_IS_TURNED_ON = ResourcesUtils.getResourcesString(
ApplicationProvider.getApplicationContext(), "wifi_is_turned_on_subtitle");
- public static final String SUBTITLE_TEXT_SELECT_NETWORK_TO_CONNECT_INTERNET =
- ResourcesUtils.getResourcesString(
- ApplicationProvider.getApplicationContext(),
- "select_network_to_connect_internet");
+ public static final String SUBTITLE_TEXT_TAP_A_NETWORK_TO_CONNECT =
+ ResourcesUtils.getResourcesString(ApplicationProvider.getApplicationContext(),
+ "tap_a_network_to_connect");
public static final String BUTTON_SETTINGS = ResourcesUtils.getResourcesString(
ApplicationProvider.getApplicationContext(), "settings_button");
public static final String SUBTITLE_NON_CARRIER_NETWORK_UNAVAILABLE =
@@ -179,7 +178,7 @@
}
@Test
- public void getSubTitle_apmOffWifiOnTwoWifiItemsNoCarrierData_selectNetworkToConnectInternet() {
+ public void getSubTitle_apmOffWifiOnTwoWifiItemsNoCarrierData_tapANetworkToConnect() {
List wifiList = new ArrayList<ScanResult>();
wifiList.add(new ScanResult());
wifiList.add(new ScanResult());
@@ -187,8 +186,7 @@
mPanel.updatePanelTitle();
- assertThat(mPanel.getSubTitle())
- .isEqualTo(SUBTITLE_TEXT_SELECT_NETWORK_TO_CONNECT_INTERNET);
+ assertThat(mPanel.getSubTitle()).isEqualTo(SUBTITLE_TEXT_TAP_A_NETWORK_TO_CONNECT);
}
@Test