Snap for 10393214 from 0e8bdf2fc0 to udc-qpr1-release

Change-Id: I76a9845437afb11cb7d8b814eb5c99bce0f6274a
This commit is contained in:
Android Build Coastguard Worker
2023-06-27 23:19:19 +00:00
9 changed files with 37 additions and 13 deletions

View File

@@ -4840,7 +4840,7 @@
</activity>
<activity android:name="Settings$FactoryResetActivity"
android:permission="android.permission.BACKUP"
android:permission="android.permission.MASTER_CLEAR"
android:label="@string/main_clear_title"
android:exported="true"
android:theme="@style/SudThemeGlif.Light">

View File

@@ -11994,7 +11994,7 @@
<!-- Developer settings: Title for force enabling Notes role. [CHAR LIMIT=50]-->
<string name="enable_notes_role_title">Force enable Notes role</string>
<!-- Developer settings: Summary for disabling phantom process monitoring. [CHAR LIMIT=NONE]-->
<string name="enable_notes_role_summary">Enable note-taking system integrations via the Notes role. If the Notes role is already enabled, does nothing.</string>
<string name="enable_notes_role_summary">Enable note-taking system integrations via the Notes role. If the Notes role is already enabled, does nothing. Requires reboot.</string>
<!-- BT LE Audio Device: Media Broadcast -->

View File

@@ -63,6 +63,7 @@ import android.os.BatteryManager;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.IBinder;
import android.os.INetworkManagementService;
import android.os.RemoteException;
@@ -97,7 +98,6 @@ import android.widget.TabWidget;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.annotation.VisibleForTesting;
import androidx.core.graphics.drawable.IconCompat;
import androidx.core.graphics.drawable.RoundedBitmapDrawable;
@@ -1309,4 +1309,15 @@ public final class Utils extends com.android.settingslib.Utils {
com.android.internal.R.bool.config_dreamsOnlyEnabledForDockUser);
return dreamsSupported && (!dreamsOnlyEnabledForDockUser || canCurrentUserDream(context));
}
/**
* Get private total size directly.
* Referred from StorageManager
*/
public static long getPrimaryStorageSize() {
// TODO(b/288103116): remove this method once support by StorageManager.
return Environment.getDataDirectory().getTotalSpace()
+ Environment.getRootDirectory().getTotalSpace();
}
}

View File

@@ -211,7 +211,9 @@ public class StorageCategoryFragment extends DashboardFragment
setLoading(false /* loading */, false /* animate */);
final long privateUsedBytes = mStorageInfo.totalBytes - mStorageInfo.freeBytes;
// TODO(b/288103116): replace with new API to get TotalBytes before rounding
// once support by StorageManager.
final long privateUsedBytes = Utils.getPrimaryStorageSize() - mStorageInfo.freeBytes;
mPreferenceController.setVolume(mSelectedStorageEntry.getVolumeInfo());
mPreferenceController.setUsedSize(privateUsedBytes);
mPreferenceController.setTotalSize(mStorageInfo.totalBytes);

View File

@@ -387,7 +387,9 @@ public class StorageDashboardFragment extends DashboardFragment
setLoading(false /* loading */, false /* animate */);
final long privateUsedBytes = mStorageInfo.totalBytes - mStorageInfo.freeBytes;
// TODO(b/288103116): replace with new API to get TotalBytes before rounding
// once support by StorageManager.
final long privateUsedBytes = Utils.getPrimaryStorageSize() - mStorageInfo.freeBytes;
mPreferenceController.setVolume(mSelectedStorageEntry.getVolumeInfo());
mPreferenceController.setUsedSize(privateUsedBytes);
mPreferenceController.setTotalSize(mStorageInfo.totalBytes);

View File

@@ -74,10 +74,14 @@ public class TopLevelStoragePreferenceController extends BasePreferenceControlle
return ThreadUtils.postOnBackgroundThread(() -> {
final PrivateStorageInfo info = PrivateStorageInfo.getPrivateStorageInfo(
getStorageManagerVolumeProvider());
storageCacheHelper.cacheUsedSize(info.totalBytes - info.freeBytes);
// TODO(b/288103116): replace with new API to get TotalBytes before rounding
// once support by StorageManager.
long usedBytes = Utils.getPrimaryStorageSize() - info.freeBytes;
storageCacheHelper.cacheUsedSize(usedBytes);
ThreadUtils.postOnMainThread(() -> {
preference.setSummary(
getSummary(info.totalBytes - info.freeBytes, info.totalBytes));
getSummary(usedBytes, info.totalBytes));
});
});
}

View File

@@ -26,6 +26,7 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.utils.ThreadUtils;
import com.android.settingslib.widget.UsageProgressBarPreference;
@@ -92,7 +93,9 @@ public class StorageUsageProgressBarPreferenceController extends BasePreferenceC
if (mStorageEntry.isPrivate()) {
// StorageStatsManager can only query private storages.
mTotalBytes = mStorageStatsManager.getTotalBytes(mStorageEntry.getFsUuid());
mUsedBytes = mTotalBytes
// TODO(b/288103116): replace with new API to get TotalBytes before rounding
// once support by StorageManager.
mUsedBytes = Utils.getPrimaryStorageSize()
- mStorageStatsManager.getFreeBytes(mStorageEntry.getFsUuid());
} else {
final File rootFile = mStorageEntry.getPath();

View File

@@ -153,7 +153,7 @@ public class NumberingSystemItemController extends BasePreferenceController {
private void handleLanguageSelect(Preference preference) {
String selectedLanguage = preference.getKey();
mMetricsFeatureProvider.action(mContext,
SettingsEnums.ACTION_CHOOSE_LANGUAGE_FOR_NUMBERS_PREFERENCES);
SettingsEnums.ACTION_CHOOSE_LANGUAGE_FOR_NUMBERS_PREFERENCES, selectedLanguage);
final Bundle extra = new Bundle();
extra.putString(RegionalPreferencesEntriesFragment.ARG_KEY_REGIONAL_PREFERENCE,
ARG_VALUE_NUMBERING_SYSTEM_SELECT);
@@ -177,7 +177,8 @@ public class NumberingSystemItemController extends BasePreferenceController {
saveNumberingSystemToLocale(Locale.forLanguageTag(mSelectedLanguage),
numberingSystem);
mMetricsFeatureProvider.action(mContext,
SettingsEnums.ACTION_SET_NUMBERS_PREFERENCES);
SettingsEnums.ACTION_SET_NUMBERS_PREFERENCES,
updatedLocale.getDisplayName() + ": " + numberingSystem);
// After updated locale to framework, this fragment will recreate,
// so it needs to update the argument of selected language.
Bundle bundle = new Bundle();

View File

@@ -59,6 +59,8 @@ public abstract class RegionalPreferenceListBasePreferenceController extends
TickButtonPreference pref = new TickButtonPreference(mContext);
mPreferenceCategory.addPreference(pref);
final String item = unitValues[i];
final String value = RegionalPreferencesDataUtils.getDefaultUnicodeExtensionData(
mContext, getExtensionTypes());
pref.setTitle(getPreferenceTitle(item));
pref.setKey(item);
pref.setOnPreferenceClickListener(clickedPref -> {
@@ -66,11 +68,10 @@ public abstract class RegionalPreferenceListBasePreferenceController extends
RegionalPreferencesDataUtils.savePreference(mContext, getExtensionTypes(),
item.equals(RegionalPreferencesDataUtils.DEFAULT_VALUE)
? null : item);
mMetricsFeatureProvider.action(mContext, getMetricsActionKey());
mMetricsFeatureProvider.action(mContext, getMetricsActionKey(),
getPreferenceTitle(value) + " > " + getPreferenceTitle(item));
return true;
});
String value = RegionalPreferencesDataUtils.getDefaultUnicodeExtensionData(mContext,
getExtensionTypes());
pref.setSelected(!value.isEmpty() && item.equals(value));
}
}