Merge "Update char limit for auto-sync data dialogs" into main
diff --git a/res/drawable/ic_category_vd_theme_24.xml b/res/drawable/ic_category_vd_theme_24.xml
new file mode 100644
index 0000000..4cf30cf
--- /dev/null
+++ b/res/drawable/ic_category_vd_theme_24.xml
@@ -0,0 +1,25 @@
+<!--
+ ~ Copyright (C) 2024 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.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="960"
+ android:viewportHeight="960"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M260,440L480,80L700,440L260,440ZM700,880Q625,880 572.5,827.5Q520,775 520,700Q520,625 572.5,572.5Q625,520 700,520Q775,520 827.5,572.5Q880,625 880,700Q880,775 827.5,827.5Q775,880 700,880ZM120,860L120,540L440,540L440,860L120,860ZM700,800Q742,800 771,771Q800,742 800,700Q800,658 771,629Q742,600 700,600Q658,600 629,629Q600,658 600,700Q600,742 629,771Q658,800 700,800ZM200,780L360,780L360,620L200,620L200,780ZM402,360L558,360L480,234L402,360ZM480,360L480,360L480,360L480,360ZM360,620L360,620L360,620L360,620L360,620ZM700,700Q700,700 700,700Q700,700 700,700Q700,700 700,700Q700,700 700,700Q700,700 700,700Q700,700 700,700Q700,700 700,700Q700,700 700,700Z"/>
+</vector>
\ No newline at end of file
diff --git a/res/values/config.xml b/res/values/config.xml
index e3d8e7d..cd17ee0 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -604,8 +604,11 @@
<!-- Media Uri to view audio storage category. -->
<string name="config_audio_storage_category_uri" translatable="false">content://com.android.providers.media.documents/root/audio_root</string>
- <!-- Media Uri to view documents & other storage category. -->
- <string name="config_documents_and_other_storage_category_uri" translatable="false">content://com.android.providers.media.documents/root/documents_root</string>
+ <!-- Media Uri to view documents storage category. -->
+ <string name="config_documents_storage_category_uri" translatable="false">content://com.android.providers.media.documents/root/documents_root</string>
+
+ <!-- Media Uri to view "other" storage category. -->
+ <string name="config_other_storage_category_uri" translatable="false">content://com.android.providers.media.documents/root/others_root</string>
<!-- Whether to show Smart Storage toggle -->
<bool name="config_show_smart_storage_toggle">true</bool>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 55f42fa..860e1c8 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -10957,9 +10957,6 @@
<!-- Preference label for the Apps storage section. [CHAR LIMIT=50] -->
<string name="storage_apps">Apps</string>
- <!-- Preference label for the Documents & other storage section. [CHAR LIMIT=50] -->
- <string name="storage_documents_and_other">Documents & other</string>
-
<!-- Old Preference label for the System storage section. [CHAR LIMIT=50] -->
<string name="storage_system">System</string>
diff --git a/res/xml/storage_category_fragment.xml b/res/xml/storage_category_fragment.xml
index 58bd891..8af6639 100644
--- a/res/xml/storage_category_fragment.xml
+++ b/res/xml/storage_category_fragment.xml
@@ -57,15 +57,20 @@
android:icon="@drawable/ic_videogame_vd_theme_24"
android:order="105"/>
<com.android.settings.deviceinfo.StorageItemPreference
- android:key="pref_documents_and_other"
- android:title="@string/storage_documents_and_other"
+ android:key="pref_documents"
+ android:title="@string/storage_documents"
android:icon="@drawable/ic_folder_vd_theme_24"
android:order="106"/>
<com.android.settings.deviceinfo.StorageItemPreference
+ android:key="pref_other"
+ android:title="@string/storage_other"
+ android:icon="@drawable/ic_category_vd_theme_24"
+ android:order="107"/>
+ <com.android.settings.deviceinfo.StorageItemPreference
android:key="pref_trash"
android:title="@string/storage_trash"
android:icon="@drawable/ic_trash_can"
- android:order="107"/>
+ android:order="108"/>
<!-- Preference order 100~200 are 'ONLY' for storage category
preferences that are sorted by size. -->
<PreferenceCategory
diff --git a/res/xml/storage_dashboard_fragment.xml b/res/xml/storage_dashboard_fragment.xml
index fd866ad..f14f4ad 100644
--- a/res/xml/storage_dashboard_fragment.xml
+++ b/res/xml/storage_dashboard_fragment.xml
@@ -76,15 +76,20 @@
android:icon="@drawable/ic_videogame_vd_theme_24"
android:order="105"/>
<com.android.settings.deviceinfo.StorageItemPreference
- android:key="pref_documents_and_other"
- android:title="@string/storage_documents_and_other"
+ android:key="pref_documents"
+ android:title="@string/storage_documents"
android:icon="@drawable/ic_folder_vd_theme_24"
android:order="106"/>
<com.android.settings.deviceinfo.StorageItemPreference
+ android:key="pref_other"
+ android:title="@string/storage_other"
+ android:icon="@drawable/ic_category_vd_theme_24"
+ android:order="107"/>
+ <com.android.settings.deviceinfo.StorageItemPreference
android:key="pref_trash"
android:title="@string/storage_trash"
android:icon="@drawable/ic_trash_can"
- android:order="107"/>
+ android:order="108"/>
<!-- Preference order 100~200 are 'ONLY' for storage category
preferences that are sorted by size. -->
<PreferenceCategory
diff --git a/src/com/android/settings/biometrics/face/FaceEnrollIntroductionInternal.java b/src/com/android/settings/biometrics/face/FaceEnrollIntroductionInternal.java
index 7dd29da..51d3a3a 100644
--- a/src/com/android/settings/biometrics/face/FaceEnrollIntroductionInternal.java
+++ b/src/com/android/settings/biometrics/face/FaceEnrollIntroductionInternal.java
@@ -16,8 +16,34 @@
package com.android.settings.biometrics.face;
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
+import android.content.Intent;
+import android.os.Bundle;
+
+import androidx.fragment.app.FragmentActivity;
+
/**
* Wrapper of {@link FaceEnrollIntroduction} to use with a pre-defined task affinity.
+ *
+ * <p>Trampolines over to FaceEnrollIntroduction - doing this as a trampoline rather than having
+ * this activity extend FaceEnrollIntroduction works around b/331157120.
*/
-public class FaceEnrollIntroductionInternal extends FaceEnrollIntroduction {
+public class FaceEnrollIntroductionInternal extends FragmentActivity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (isFinishing()) {
+ return;
+ }
+
+ // Copy our intent to grab all extras. Drop flags so we don't start new tasks twice.
+ Intent trampoline = new Intent(getIntent());
+ trampoline.setFlags(0);
+
+ // Trampoline to the intended activity, and finish
+ trampoline.setClassName(SETTINGS_PACKAGE_NAME, FaceEnrollIntroduction.class.getName());
+ startActivity(trampoline);
+ finish();
+ }
}
diff --git a/src/com/android/settings/datausage/ChartDataUsagePreference.java b/src/com/android/settings/datausage/ChartDataUsagePreference.java
index e8e2109..0c7db71 100644
--- a/src/com/android/settings/datausage/ChartDataUsagePreference.java
+++ b/src/com/android/settings/datausage/ChartDataUsagePreference.java
@@ -124,7 +124,7 @@
UsageView chart, @NonNull List<NetworkUsageData> usageSummary) {
final Context context = getContext();
final StringBuilder contentDescription = new StringBuilder();
- final int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_ABBREV_MONTH;
+ final int flags = DateUtils.FORMAT_SHOW_DATE;
// Setup a brief content description.
final String startDate = DateUtils.formatDateTime(context, mStart, flags);
@@ -153,7 +153,7 @@
nodeDate = DateUtils.formatDateRange(context, data.getStartTime(),
data.getEndTime(), flags);
}
- nodeContentDescription = String.format(";%s %d%%", nodeDate, dataUsagePercentage);
+ nodeContentDescription = String.format("; %s, %d%%", nodeDate, dataUsagePercentage);
contentDescription.append(nodeContentDescription);
}
diff --git a/src/com/android/settings/deviceinfo/storage/StorageAsyncLoader.java b/src/com/android/settings/deviceinfo/storage/StorageAsyncLoader.java
index 4906cf2..7b8b237 100644
--- a/src/com/android/settings/deviceinfo/storage/StorageAsyncLoader.java
+++ b/src/com/android/settings/deviceinfo/storage/StorageAsyncLoader.java
@@ -98,15 +98,24 @@
media /* queryArgs */);
result.systemSize = getSystemSize();
- final Bundle documentsAndOtherQueryArgs = new Bundle();
- documentsAndOtherQueryArgs.putString(ContentResolver.QUERY_ARG_SQL_SELECTION,
- FileColumns.MEDIA_TYPE + "!=" + FileColumns.MEDIA_TYPE_IMAGE
- + " AND " + FileColumns.MEDIA_TYPE + "!=" + FileColumns.MEDIA_TYPE_VIDEO
- + " AND " + FileColumns.MEDIA_TYPE + "!=" + FileColumns.MEDIA_TYPE_AUDIO
- + " AND " + FileColumns.MIME_TYPE + " IS NOT NULL");
- result.documentsAndOtherSize = getFilesSize(info.id,
+ final Bundle documentsQueryArgs = new Bundle();
+ documentsQueryArgs.putString(ContentResolver.QUERY_ARG_SQL_SELECTION,
+ FileColumns.MEDIA_TYPE + "=" + FileColumns.MEDIA_TYPE_DOCUMENT);
+ result.documentsSize = getFilesSize(info.id,
MediaStore.Files.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY),
- documentsAndOtherQueryArgs);
+ documentsQueryArgs);
+
+ final Bundle otherQueryArgs = new Bundle();
+ otherQueryArgs.putString(ContentResolver.QUERY_ARG_SQL_SELECTION,
+ FileColumns.MEDIA_TYPE + "!=" + FileColumns.MEDIA_TYPE_IMAGE
+ + " AND " + FileColumns.MEDIA_TYPE + "!=" + FileColumns.MEDIA_TYPE_VIDEO
+ + " AND " + FileColumns.MEDIA_TYPE + "!=" + FileColumns.MEDIA_TYPE_AUDIO
+ + " AND " + FileColumns.MEDIA_TYPE + "!="
+ + FileColumns.MEDIA_TYPE_DOCUMENT
+ + " AND " + FileColumns.MIME_TYPE + " IS NOT NULL");
+ result.otherSize = getFilesSize(info.id,
+ MediaStore.Files.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY),
+ otherQueryArgs);
final Bundle trashQueryArgs = new Bundle();
trashQueryArgs.putInt(MediaStore.QUERY_ARG_MATCH_TRASHED, MediaStore.MATCH_ONLY);
@@ -236,7 +245,8 @@
public long audioSize;
public long imagesSize;
public long videosSize;
- public long documentsAndOtherSize;
+ public long documentsSize;
+ public long otherSize;
public long trashSize;
public long systemSize;
diff --git a/src/com/android/settings/deviceinfo/storage/StorageCacheHelper.java b/src/com/android/settings/deviceinfo/storage/StorageCacheHelper.java
index 50690cb..253427f 100644
--- a/src/com/android/settings/deviceinfo/storage/StorageCacheHelper.java
+++ b/src/com/android/settings/deviceinfo/storage/StorageCacheHelper.java
@@ -32,7 +32,8 @@
private static final String AUDIO_SIZE_KEY = "audio_size_key";
private static final String APPS_SIZE_KEY = "apps_size_key";
private static final String GAMES_SIZE_KEY = "games_size_key";
- private static final String DOCUMENTS_AND_OTHER_SIZE_KEY = "documents_and_other_size_key";
+ private static final String DOCUMENTS_SIZE_KEY = "documents_size_key";
+ private static final String OTHER_SIZE_KEY = "other_size_key";
private static final String TRASH_SIZE_KEY = "trash_size_key";
private static final String SYSTEM_SIZE_KEY = "system_size_key";
private static final String TEMPORARY_FILES_SIZE_KEY = "temporary_files_size_key";
@@ -64,7 +65,8 @@
.putLong(AUDIO_SIZE_KEY, data.audioSize)
.putLong(APPS_SIZE_KEY, data.allAppsExceptGamesSize)
.putLong(GAMES_SIZE_KEY, data.gamesSize)
- .putLong(DOCUMENTS_AND_OTHER_SIZE_KEY, data.documentsAndOtherSize)
+ .putLong(DOCUMENTS_SIZE_KEY, data.documentsSize)
+ .putLong(OTHER_SIZE_KEY, data.otherSize)
.putLong(TRASH_SIZE_KEY, data.trashSize)
.putLong(SYSTEM_SIZE_KEY, data.systemSize)
.putLong(TEMPORARY_FILES_SIZE_KEY, data.temporaryFilesSize)
@@ -108,7 +110,8 @@
result.audioSize = mSharedPreferences.getLong(AUDIO_SIZE_KEY, 0);
result.allAppsExceptGamesSize = mSharedPreferences.getLong(APPS_SIZE_KEY, 0);
result.gamesSize = mSharedPreferences.getLong(GAMES_SIZE_KEY, 0);
- result.documentsAndOtherSize = mSharedPreferences.getLong(DOCUMENTS_AND_OTHER_SIZE_KEY, 0);
+ result.documentsSize = mSharedPreferences.getLong(DOCUMENTS_SIZE_KEY, 0);
+ result.otherSize = mSharedPreferences.getLong(OTHER_SIZE_KEY, 0);
result.trashSize = mSharedPreferences.getLong(TRASH_SIZE_KEY, 0);
result.systemSize = mSharedPreferences.getLong(SYSTEM_SIZE_KEY, 0);
result.temporaryFilesSize = mSharedPreferences.getLong(TEMPORARY_FILES_SIZE_KEY, 0);
@@ -126,7 +129,8 @@
public long audioSize;
public long imagesSize;
public long videosSize;
- public long documentsAndOtherSize;
+ public long documentsSize;
+ public long otherSize;
public long trashSize;
public long systemSize;
public long temporaryFilesSize;
diff --git a/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java b/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
index 62422ca..d4e2b7a 100644
--- a/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
@@ -92,7 +92,9 @@
@VisibleForTesting
static final String GAMES_KEY = "pref_games";
@VisibleForTesting
- static final String DOCUMENTS_AND_OTHER_KEY = "pref_documents_and_other";
+ static final String DOCUMENTS_KEY = "pref_documents";
+ @VisibleForTesting
+ static final String OTHER_KEY = "pref_other";
@VisibleForTesting
static final String SYSTEM_KEY = "pref_system";
@VisibleForTesting
@@ -109,7 +111,9 @@
@VisibleForTesting
final Uri mAudioUri;
@VisibleForTesting
- final Uri mDocumentsAndOtherUri;
+ final Uri mDocumentsUri;
+ @VisibleForTesting
+ final Uri mOtherUri;
// This value should align with the design of storage_dashboard_fragment.xml
private static final int LAST_STORAGE_CATEGORY_PREFERENCE_ORDER = 200;
@@ -139,7 +143,9 @@
@VisibleForTesting
@Nullable StorageItemPreference mGamesPreference;
@VisibleForTesting
- @Nullable StorageItemPreference mDocumentsAndOtherPreference;
+ @Nullable StorageItemPreference mDocumentsPreference;
+ @VisibleForTesting
+ @Nullable StorageItemPreference mOtherPreference;
@VisibleForTesting
@Nullable StorageItemPreference mTrashPreference;
@VisibleForTesting
@@ -186,8 +192,10 @@
.getString(R.string.config_videos_storage_category_uri));
mAudioUri = Uri.parse(context.getResources()
.getString(R.string.config_audio_storage_category_uri));
- mDocumentsAndOtherUri = Uri.parse(context.getResources()
- .getString(R.string.config_documents_and_other_storage_category_uri));
+ mDocumentsUri = Uri.parse(context.getResources()
+ .getString(R.string.config_documents_storage_category_uri));
+ mOtherUri = Uri.parse(context.getResources()
+ .getString(R.string.config_other_storage_category_uri));
}
@VisibleForTesting
@@ -224,8 +232,11 @@
case GAMES_KEY:
launchGamesIntent();
return true;
- case DOCUMENTS_AND_OTHER_KEY:
- launchActivityWithUri(mDocumentsAndOtherUri);
+ case DOCUMENTS_KEY:
+ launchActivityWithUri(mDocumentsUri);
+ return true;
+ case OTHER_KEY:
+ launchActivityWithUri(mOtherUri);
return true;
case SYSTEM_KEY:
final SystemInfoFragment dialog = new SystemInfoFragment();
@@ -311,9 +322,11 @@
// If we don't have a shared volume for our internal storage (or the shared volume isn't
// mounted as readable for whatever reason), we should hide the File preference.
if (visible) {
- mDocumentsAndOtherPreference.setVisible(mIsDocumentsPrefShown);
+ mDocumentsPreference.setVisible(mIsDocumentsPrefShown);
+ mOtherPreference.setVisible(mIsDocumentsPrefShown);
} else {
- mDocumentsAndOtherPreference.setVisible(false);
+ mDocumentsPreference.setVisible(false);
+ mOtherPreference.setVisible(false);
}
}
@@ -330,20 +343,24 @@
if (mPrivateStorageItemPreferences == null) {
mPrivateStorageItemPreferences = new ArrayList<>();
- mPrivateStorageItemPreferences.add(mImagesPreference);
- mPrivateStorageItemPreferences.add(mVideosPreference);
- mPrivateStorageItemPreferences.add(mAudioPreference);
- mPrivateStorageItemPreferences.add(mAppsPreference);
- mPrivateStorageItemPreferences.add(mGamesPreference);
- mPrivateStorageItemPreferences.add(mDocumentsAndOtherPreference);
+ // Adding categories in the reverse order so that
+ // They would be in the right order after sorting
mPrivateStorageItemPreferences.add(mTrashPreference);
+ mPrivateStorageItemPreferences.add(mOtherPreference);
+ mPrivateStorageItemPreferences.add(mDocumentsPreference);
+ mPrivateStorageItemPreferences.add(mGamesPreference);
+ mPrivateStorageItemPreferences.add(mAppsPreference);
+ mPrivateStorageItemPreferences.add(mAudioPreference);
+ mPrivateStorageItemPreferences.add(mVideosPreference);
+ mPrivateStorageItemPreferences.add(mImagesPreference);
}
mScreen.removePreference(mImagesPreference);
mScreen.removePreference(mVideosPreference);
mScreen.removePreference(mAudioPreference);
mScreen.removePreference(mAppsPreference);
mScreen.removePreference(mGamesPreference);
- mScreen.removePreference(mDocumentsAndOtherPreference);
+ mScreen.removePreference(mDocumentsPreference);
+ mScreen.removePreference(mOtherPreference);
mScreen.removePreference(mTrashPreference);
// Sort display order by size.
@@ -378,7 +395,8 @@
tintPreference(mAudioPreference);
tintPreference(mAppsPreference);
tintPreference(mGamesPreference);
- tintPreference(mDocumentsAndOtherPreference);
+ tintPreference(mDocumentsPreference);
+ tintPreference(mOtherPreference);
tintPreference(mSystemPreference);
tintPreference(mTemporaryFilesPreference);
tintPreference(mTrashPreference);
@@ -408,7 +426,8 @@
mAudioPreference = screen.findPreference(AUDIO_KEY);
mAppsPreference = screen.findPreference(APPS_KEY);
mGamesPreference = screen.findPreference(GAMES_KEY);
- mDocumentsAndOtherPreference = screen.findPreference(DOCUMENTS_AND_OTHER_KEY);
+ mDocumentsPreference = screen.findPreference(DOCUMENTS_KEY);
+ mOtherPreference = screen.findPreference(OTHER_KEY);
mCategorySplitterPreferenceCategory = screen.findPreference(CATEGORY_SPLITTER);
mSystemPreference = screen.findPreference(SYSTEM_KEY);
mTemporaryFilesPreference = screen.findPreference(TEMPORARY_FILES_KEY);
@@ -434,8 +453,8 @@
mAudioPreference.setStorageSize(storageCache.audioSize, mTotalSize, animate);
mAppsPreference.setStorageSize(storageCache.allAppsExceptGamesSize, mTotalSize, animate);
mGamesPreference.setStorageSize(storageCache.gamesSize, mTotalSize, animate);
- mDocumentsAndOtherPreference.setStorageSize(storageCache.documentsAndOtherSize, mTotalSize,
- animate);
+ mDocumentsPreference.setStorageSize(storageCache.documentsSize, mTotalSize, animate);
+ mOtherPreference.setStorageSize(storageCache.otherSize, mTotalSize, animate);
mTrashPreference.setStorageSize(storageCache.trashSize, mTotalSize, animate);
if (mSystemPreference != null) {
mSystemPreference.setStorageSize(storageCache.systemSize, mTotalSize, animate);
@@ -471,7 +490,8 @@
storageCache.audioSize = data.audioSize;
storageCache.allAppsExceptGamesSize = data.allAppsExceptGamesSize;
storageCache.gamesSize = data.gamesSize;
- storageCache.documentsAndOtherSize = data.documentsAndOtherSize;
+ storageCache.documentsSize = data.documentsSize;
+ storageCache.otherSize = data.otherSize;
storageCache.trashSize = data.trashSize;
storageCache.systemSize = data.systemSize;
// Everything else that hasn't already been attributed is tracked as
@@ -484,7 +504,8 @@
+ otherData.audioSize
+ otherData.videosSize
+ otherData.imagesSize
- + otherData.documentsAndOtherSize
+ + otherData.documentsSize
+ + otherData.otherSize
+ otherData.trashSize
+ otherData.allAppsExceptGamesSize;
attributedSize -= otherData.duplicateCodeSize;
diff --git a/src/com/android/settings/spa/network/SimsSection.kt b/src/com/android/settings/spa/network/SimsSection.kt
index bf0a33e..df92b37 100644
--- a/src/com/android/settings/spa/network/SimsSection.kt
+++ b/src/com/android/settings/spa/network/SimsSection.kt
@@ -24,6 +24,8 @@
import androidx.compose.foundation.layout.Column
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Add
+import androidx.compose.material.icons.outlined.SimCard
+import androidx.compose.material.icons.outlined.SimCardDownload
import androidx.compose.runtime.Composable
import androidx.compose.runtime.State
import androidx.compose.runtime.remember
@@ -65,6 +67,7 @@
model = object : SwitchPreferenceModel {
override val title = subInfo.displayName.toString()
override val summary = { phoneNumber.value ?: "" }
+ override val icon = @Composable { SimIcon(subInfo.isEmbedded) }
override val checked = { checked.value }
override val onCheckedChange = { newChecked: Boolean ->
SubscriptionUtil.startToggleSubscriptionDialogActivity(
@@ -81,6 +84,11 @@
}
@Composable
+private fun SimIcon(isEmbedded: Boolean) {
+ SettingsIcon(if (isEmbedded) Icons.Outlined.SimCardDownload else Icons.Outlined.SimCard)
+}
+
+@Composable
fun phoneNumber(subInfo: SubscriptionInfo): State<String?> {
val context = LocalContext.current
return remember(subInfo) {
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/storage/StorageCacheHelperTest.java b/tests/robotests/src/com/android/settings/deviceinfo/storage/StorageCacheHelperTest.java
index a26ea1d..6468446 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/storage/StorageCacheHelperTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/storage/StorageCacheHelperTest.java
@@ -36,6 +36,7 @@
private static final long FAKE_APPS_SIZE = 4000L;
private static final long FAKE_GAMES_SIZE = 5000L;
private static final long FAKE_DOCS_SIZE = 1500L;
+ private static final long FAKE_OTHER_SIZE = 2000L;
private static final long FAKE_TRASH_SIZE = 500L;
private static final long FAKE_SYSTEM_SIZE = 2300L;
private static final long FAKE_TOTAL_SIZE = 256000L;
@@ -72,6 +73,8 @@
assertThat(storageCache.imagesSize).isEqualTo(FAKE_IMAGES_SIZE);
assertThat(storageCache.temporaryFilesSize).isEqualTo(FAKE_TEMPORARY_FILES_SIZE);
+ assertThat(storageCache.documentsSize).isEqualTo(FAKE_DOCS_SIZE);
+ assertThat(storageCache.otherSize).isEqualTo(FAKE_OTHER_SIZE);
assertThat(storageCache.totalSize).isEqualTo(0);
}
@@ -97,7 +100,8 @@
result.trashSize = FAKE_TRASH_SIZE;
result.systemSize = FAKE_SYSTEM_SIZE;
result.imagesSize = FAKE_IMAGES_SIZE;
- result.documentsAndOtherSize = FAKE_DOCS_SIZE;
+ result.documentsSize = FAKE_DOCS_SIZE;
+ result.otherSize = FAKE_OTHER_SIZE;
result.audioSize = FAKE_AUDIO_SIZE;
result.gamesSize = FAKE_GAMES_SIZE;
result.videosSize = FAKE_VIDEOS_SIZE;
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceControllerTest.java
index 2590f52..306d80c 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceControllerTest.java
@@ -124,8 +124,10 @@
apps.setIcon(R.drawable.ic_storage_apps);
final StorageItemPreference games = spy(new StorageItemPreference(mContext));
games.setIcon(R.drawable.ic_videogame_vd_theme_24);
- final StorageItemPreference documentsAndOther = spy(new StorageItemPreference(mContext));
- documentsAndOther.setIcon(R.drawable.ic_folder_vd_theme_24);
+ final StorageItemPreference documents = spy(new StorageItemPreference(mContext));
+ documents.setIcon(R.drawable.ic_folder_vd_theme_24);
+ final StorageItemPreference other = spy(new StorageItemPreference(mContext));
+ other.setIcon(R.drawable.ic_category_vd_theme_24);
final StorageItemPreference system = spy(new StorageItemPreference(mContext));
system.setIcon(R.drawable.ic_android_vd_theme_24);
final StorageItemPreference temporaryFiles = spy(new StorageItemPreference(mContext));
@@ -147,8 +149,10 @@
.thenReturn(apps);
when(screen.findPreference(eq(StorageItemPreferenceController.GAMES_KEY)))
.thenReturn(games);
- when(screen.findPreference(eq(StorageItemPreferenceController.DOCUMENTS_AND_OTHER_KEY)))
- .thenReturn(documentsAndOther);
+ when(screen.findPreference(eq(StorageItemPreferenceController.DOCUMENTS_KEY)))
+ .thenReturn(documents);
+ when(screen.findPreference(eq(StorageItemPreferenceController.OTHER_KEY)))
+ .thenReturn(other);
when(screen.findPreference(eq(StorageItemPreferenceController.SYSTEM_KEY)))
.thenReturn(system);
when(screen.findPreference(eq(StorageItemPreferenceController.TEMPORARY_FILES_KEY)))
@@ -225,7 +229,8 @@
assertThat(mController.mAudioPreference.isVisible()).isFalse();
assertThat(mController.mAppsPreference.isVisible()).isFalse();
assertThat(mController.mGamesPreference.isVisible()).isFalse();
- assertThat(mController.mDocumentsAndOtherPreference.isVisible()).isFalse();
+ assertThat(mController.mDocumentsPreference.isVisible()).isFalse();
+ assertThat(mController.mOtherPreference.isVisible()).isFalse();
assertThat(mController.mSystemPreference.isVisible()).isFalse();
assertThat(mController.mTemporaryFilesPreference.isVisible()).isFalse();
assertThat(mController.mTrashPreference.isVisible()).isFalse();
@@ -278,8 +283,8 @@
}
@Test
- public void launchDocumentsAndOtherIntent_resolveActionViewNull_settingsIntent() {
- mPreference.setKey(StorageItemPreferenceController.DOCUMENTS_AND_OTHER_KEY);
+ public void launchDocumentsIntent_resolveActionViewNull_settingsIntent() {
+ mPreference.setKey(StorageItemPreferenceController.DOCUMENTS_KEY);
final Context mockContext = getMockContext();
mController = new StorageItemPreferenceController(mockContext, mFragment, mVolume,
mSvp, ProfileSelectFragment.ProfileType.PERSONAL);
@@ -291,7 +296,24 @@
Intent intent = argumentCaptor.getValue();
assertThat(intent.getAction()).isEqualTo(Intent.ACTION_VIEW);
- assertThat(intent.getData()).isEqualTo(mController.mDocumentsAndOtherUri);
+ assertThat(intent.getData()).isEqualTo(mController.mDocumentsUri);
+ }
+
+ @Test
+ public void launchOtherIntent_resolveActionViewNull_settingsIntent() {
+ mPreference.setKey(StorageItemPreferenceController.OTHER_KEY);
+ final Context mockContext = getMockContext();
+ mController = new StorageItemPreferenceController(mockContext, mFragment, mVolume,
+ mSvp, ProfileSelectFragment.ProfileType.PERSONAL);
+ mController.handlePreferenceTreeClick(mPreference);
+
+ final ArgumentCaptor<Intent> argumentCaptor = ArgumentCaptor.forClass(Intent.class);
+ verify(mockContext).startActivityAsUser(argumentCaptor.capture(),
+ nullable(UserHandle.class));
+
+ Intent intent = argumentCaptor.getValue();
+ assertThat(intent.getAction()).isEqualTo(Intent.ACTION_VIEW);
+ assertThat(intent.getData()).isEqualTo(mController.mOtherUri);
}
@Test
@@ -359,7 +381,8 @@
result.imagesSize = MEGABYTE_IN_BYTES * 350;
result.videosSize = GIGABYTE_IN_BYTES * 30;
result.audioSize = MEGABYTE_IN_BYTES * 40;
- result.documentsAndOtherSize = MEGABYTE_IN_BYTES * 50;
+ result.documentsSize = MEGABYTE_IN_BYTES * 50;
+ result.otherSize = MEGABYTE_IN_BYTES * 70;
result.trashSize = KILOBYTE_IN_BYTES * 100;
result.allAppsExceptGamesSize = MEGABYTE_IN_BYTES * 90;
result.systemSize = MEGABYTE_IN_BYTES * 60;
@@ -373,8 +396,8 @@
assertThat(mController.mAudioPreference.getSummary().toString()).isEqualTo("40 MB");
assertThat(mController.mAppsPreference.getSummary().toString()).isEqualTo("90 MB");
assertThat(mController.mGamesPreference.getSummary().toString()).isEqualTo("80 MB");
- assertThat(mController.mDocumentsAndOtherPreference.getSummary().toString())
- .isEqualTo("50 MB");
+ assertThat(mController.mDocumentsPreference.getSummary().toString()).isEqualTo("50 MB");
+ assertThat(mController.mOtherPreference.getSummary().toString()).isEqualTo("70 MB");
assertThat(mController.mTrashPreference.getSummary().toString()).isEqualTo("100 kB");
assertThat(mController.mSystemPreference.getSummary().toString())
.isEqualTo("60 MB");
@@ -392,8 +415,8 @@
verify(mController.mAudioPreference, times(2)).setIcon(nullable(Drawable.class));
verify(mController.mAppsPreference, times(2)).setIcon(nullable(Drawable.class));
verify(mController.mGamesPreference, times(2)).setIcon(nullable(Drawable.class));
- verify(mController.mDocumentsAndOtherPreference, times(2))
- .setIcon(nullable(Drawable.class));
+ verify(mController.mDocumentsPreference, times(2)).setIcon(nullable(Drawable.class));
+ verify(mController.mOtherPreference, times(2)).setIcon(nullable(Drawable.class));
verify(mController.mSystemPreference, times(2)).setIcon(nullable(Drawable.class));
verify(mController.mTemporaryFilesPreference, times(2)).setIcon(nullable(Drawable.class));
verify(mController.mTrashPreference, times(2)).setIcon(nullable(Drawable.class));
@@ -408,7 +431,8 @@
mController.displayPreference(mPreferenceScreen);
- assertThat(mController.mDocumentsAndOtherPreference.isVisible()).isTrue();
+ assertThat(mController.mDocumentsPreference.isVisible()).isTrue();
+ assertThat(mController.mOtherPreference.isVisible()).isTrue();
}
@Test
@@ -423,7 +447,8 @@
mController.setPrivateStorageCategoryPreferencesVisibility(true);
- assertThat(mController.mDocumentsAndOtherPreference.isVisible()).isFalse();
+ assertThat(mController.mDocumentsPreference.isVisible()).isFalse();
+ assertThat(mController.mOtherPreference.isVisible()).isFalse();
}
@Test
@@ -438,7 +463,8 @@
// And we bring it back.
mController.setVolume(mVolume);
- assertThat(mController.mDocumentsAndOtherPreference.isVisible()).isTrue();
+ assertThat(mController.mDocumentsPreference.isVisible()).isTrue();
+ assertThat(mController.mOtherPreference.isVisible()).isTrue();
}
@Test
@@ -458,7 +484,8 @@
assertThat(mController.mAudioPreference.isVisible()).isFalse();
assertThat(mController.mAppsPreference.isVisible()).isFalse();
assertThat(mController.mGamesPreference.isVisible()).isFalse();
- assertThat(mController.mDocumentsAndOtherPreference.isVisible()).isFalse();
+ assertThat(mController.mDocumentsPreference.isVisible()).isFalse();
+ assertThat(mController.mOtherPreference.isVisible()).isFalse();
assertThat(mController.mSystemPreference.isVisible()).isFalse();
assertThat(mController.mTemporaryFilesPreference.isVisible()).isFalse();
assertThat(mController.mTrashPreference.isVisible()).isFalse();