Merge "Add a movies & tv apps category to storage settings." into oc-dev
am: c365a8735c
Change-Id: I665759c8ce9c74d83a1167c5d04e5134ff697d08
This commit is contained in:
@@ -121,6 +121,7 @@ public class Settings extends SettingsActivity {
|
||||
public static class ManageDomainUrlsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class AutomaticStorageManagerSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
public static class GamesStorageActivity extends SettingsActivity { /* empty */ }
|
||||
public static class MoviesStorageActivity extends SettingsActivity { /* empty */ }
|
||||
|
||||
public static class TopLevelSettings extends SettingsActivity { /* empty */ }
|
||||
public static class ApnSettingsActivity extends SettingsActivity { /* empty */ }
|
||||
|
@@ -63,6 +63,7 @@ import com.android.settings.Settings.AllApplicationsActivity;
|
||||
import com.android.settings.Settings.GamesStorageActivity;
|
||||
import com.android.settings.Settings.HighPowerApplicationsActivity;
|
||||
import com.android.settings.Settings.ManageExternalSourcesActivity;
|
||||
import com.android.settings.Settings.MoviesStorageActivity;
|
||||
import com.android.settings.Settings.NotificationAppListActivity;
|
||||
import com.android.settings.Settings.OverlaySettingsActivity;
|
||||
import com.android.settings.Settings.StorageUseActivity;
|
||||
@@ -256,6 +257,7 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
||||
public static final int LIST_TYPE_WRITE_SETTINGS = 7;
|
||||
public static final int LIST_TYPE_MANAGE_SOURCES = 8;
|
||||
public static final int LIST_TYPE_GAMES = 9;
|
||||
public static final int LIST_TYPE_MOVIES = 10;
|
||||
|
||||
|
||||
// List types that should show instant apps.
|
||||
@@ -316,6 +318,9 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
||||
} else if (className.equals(GamesStorageActivity.class.getName())) {
|
||||
mListType = LIST_TYPE_GAMES;
|
||||
mSortOrder = R.id.sort_order_size;
|
||||
} else if (className.equals(MoviesStorageActivity.class.getName())) {
|
||||
mListType = LIST_TYPE_MOVIES;
|
||||
mSortOrder = R.id.sort_order_size;
|
||||
} else {
|
||||
mListType = LIST_TYPE_MAIN;
|
||||
}
|
||||
@@ -424,6 +429,8 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
||||
}
|
||||
if (mListType == LIST_TYPE_GAMES) {
|
||||
mApplications.setOverrideFilter(ApplicationsState.FILTER_GAMES);
|
||||
} else if (mListType == LIST_TYPE_MOVIES) {
|
||||
mApplications.setOverrideFilter(ApplicationsState.FILTER_MOVIES);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,6 +457,7 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
||||
case LIST_TYPE_NOTIFICATION:
|
||||
case LIST_TYPE_STORAGE:
|
||||
case LIST_TYPE_GAMES:
|
||||
case LIST_TYPE_MOVIES:
|
||||
return mSortOrder == R.id.sort_order_alpha;
|
||||
default:
|
||||
return false;
|
||||
@@ -470,6 +478,8 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
||||
return MetricsEvent.APPLICATIONS_STORAGE_APPS;
|
||||
case LIST_TYPE_GAMES:
|
||||
return MetricsEvent.APPLICATIONS_STORAGE_GAMES;
|
||||
case LIST_TYPE_MOVIES:
|
||||
return MetricsEvent.APPLICATIONS_STORAGE_MOVIES;
|
||||
case LIST_TYPE_USAGE_ACCESS:
|
||||
return MetricsEvent.USAGE_ACCESS;
|
||||
case LIST_TYPE_HIGH_POWER:
|
||||
@@ -577,6 +587,9 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
||||
case LIST_TYPE_GAMES:
|
||||
startAppInfoFragment(AppStorageSettings.class, R.string.game_storage_settings);
|
||||
break;
|
||||
case LIST_TYPE_MOVIES:
|
||||
startAppInfoFragment(AppStorageSettings.class, R.string.storage_movies_tv);
|
||||
break;
|
||||
// TODO: Figure out if there is a way where we can spin up the profile's settings
|
||||
// process ahead of time, to avoid a long load of data when user clicks on a managed app.
|
||||
// Maybe when they load the list of apps that contains managed profile apps.
|
||||
|
@@ -140,6 +140,7 @@ public class StorageProfileFragment extends DashboardFragment
|
||||
// TODO(b/35927909): Attribute app sizes better than zeroing out for profiles.
|
||||
result.gamesSize = 0;
|
||||
result.musicAppsSize = 0;
|
||||
result.videoAppsSize = 0;
|
||||
result.otherAppsSize = 0;
|
||||
return result;
|
||||
}
|
||||
|
@@ -18,6 +18,7 @@ package com.android.settings.deviceinfo.storage;
|
||||
|
||||
import static android.content.pm.ApplicationInfo.CATEGORY_AUDIO;
|
||||
import static android.content.pm.ApplicationInfo.CATEGORY_GAME;
|
||||
import static android.content.pm.ApplicationInfo.CATEGORY_VIDEO;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
@@ -99,6 +100,9 @@ public class StorageAsyncLoader
|
||||
case CATEGORY_AUDIO:
|
||||
result.musicAppsSize += attributedAppSizeInBytes;
|
||||
break;
|
||||
case CATEGORY_VIDEO:
|
||||
result.videoAppsSize += attributedAppSizeInBytes;
|
||||
break;
|
||||
default:
|
||||
// The deprecated game flag does not set the category.
|
||||
if ((app.flags & ApplicationInfo.FLAG_IS_GAME) != 0) {
|
||||
@@ -123,6 +127,7 @@ public class StorageAsyncLoader
|
||||
public static class AppsStorageResult {
|
||||
public long gamesSize;
|
||||
public long musicAppsSize;
|
||||
public long videoAppsSize;
|
||||
public long otherAppsSize;
|
||||
public long systemSize;
|
||||
public StorageStatsSource.ExternalStorageStats externalStats;
|
||||
|
@@ -65,6 +65,8 @@ public class StorageItemPreferenceController extends PreferenceController {
|
||||
@VisibleForTesting
|
||||
static final String GAME_KEY = "pref_games";
|
||||
@VisibleForTesting
|
||||
static final String MOVIES_KEY = "pref_movies";
|
||||
@VisibleForTesting
|
||||
static final String OTHER_APPS_KEY = "pref_other_apps";
|
||||
@VisibleForTesting
|
||||
static final String SYSTEM_KEY = "pref_system";
|
||||
@@ -82,6 +84,7 @@ public class StorageItemPreferenceController extends PreferenceController {
|
||||
private StorageItemPreference mPhotoPreference;
|
||||
private StorageItemPreference mAudioPreference;
|
||||
private StorageItemPreference mGamePreference;
|
||||
private StorageItemPreference mMoviesPreference;
|
||||
private StorageItemPreference mAppPreference;
|
||||
private StorageItemPreference mFilePreference;
|
||||
private StorageItemPreference mSystemPreference;
|
||||
@@ -123,6 +126,9 @@ public class StorageItemPreferenceController extends PreferenceController {
|
||||
case GAME_KEY:
|
||||
intent = getGamesIntent();
|
||||
break;
|
||||
case MOVIES_KEY:
|
||||
intent = getMoviesIntent();
|
||||
break;
|
||||
case OTHER_APPS_KEY:
|
||||
// Because we are likely constructed with a null volume, this is theoretically
|
||||
// possible.
|
||||
@@ -204,6 +210,7 @@ public class StorageItemPreferenceController extends PreferenceController {
|
||||
mPhotoPreference = (StorageItemPreference) screen.findPreference(PHOTO_KEY);
|
||||
mAudioPreference = (StorageItemPreference) screen.findPreference(AUDIO_KEY);
|
||||
mGamePreference = (StorageItemPreference) screen.findPreference(GAME_KEY);
|
||||
mMoviesPreference = (StorageItemPreference) screen.findPreference(MOVIES_KEY);
|
||||
mAppPreference = (StorageItemPreference) screen.findPreference(OTHER_APPS_KEY);
|
||||
mSystemPreference = (StorageItemPreference) screen.findPreference(SYSTEM_KEY);
|
||||
mFilePreference = (StorageItemPreference) screen.findPreference(FILES_KEY);
|
||||
@@ -217,6 +224,7 @@ public class StorageItemPreferenceController extends PreferenceController {
|
||||
mAudioPreference.setStorageSize(
|
||||
data.musicAppsSize + data.externalStats.audioBytes, mTotalSize);
|
||||
mGamePreference.setStorageSize(data.gamesSize, mTotalSize);
|
||||
mMoviesPreference.setStorageSize(data.videoAppsSize, mTotalSize);
|
||||
mAppPreference.setStorageSize(data.otherAppsSize, mTotalSize);
|
||||
if (mSystemPreference != null) {
|
||||
mSystemPreference.setStorageSize(mSystemSize + data.systemSize, mTotalSize);
|
||||
@@ -243,6 +251,7 @@ public class StorageItemPreferenceController extends PreferenceController {
|
||||
list.add(PHOTO_KEY);
|
||||
list.add(AUDIO_KEY);
|
||||
list.add(GAME_KEY);
|
||||
list.add(MOVIES_KEY);
|
||||
list.add(OTHER_APPS_KEY);
|
||||
list.add(SYSTEM_KEY);
|
||||
list.add(FILES_KEY);
|
||||
@@ -281,12 +290,21 @@ public class StorageItemPreferenceController extends PreferenceController {
|
||||
}
|
||||
|
||||
private Intent getGamesIntent() {
|
||||
Bundle args = new Bundle(1);
|
||||
args.putString(ManageApplications.EXTRA_CLASSNAME,
|
||||
Settings.GamesStorageActivity.class.getName());
|
||||
return Utils.onBuildStartFragmentIntent(mContext,
|
||||
ManageApplications.class.getName(), args, null, R.string.game_storage_settings,
|
||||
null, false, mMetricsFeatureProvider.getMetricsCategory(mFragment));
|
||||
Bundle args = new Bundle(1);
|
||||
args.putString(ManageApplications.EXTRA_CLASSNAME,
|
||||
Settings.GamesStorageActivity.class.getName());
|
||||
return Utils.onBuildStartFragmentIntent(mContext,
|
||||
ManageApplications.class.getName(), args, null, R.string.game_storage_settings,
|
||||
null, false, mMetricsFeatureProvider.getMetricsCategory(mFragment));
|
||||
}
|
||||
|
||||
private Intent getMoviesIntent() {
|
||||
Bundle args = new Bundle(1);
|
||||
args.putString(ManageApplications.EXTRA_CLASSNAME,
|
||||
Settings.MoviesStorageActivity.class.getName());
|
||||
return Utils.onBuildStartFragmentIntent(mContext,
|
||||
ManageApplications.class.getName(), args, null, R.string.storage_movies_tv,
|
||||
null, false, mMetricsFeatureProvider.getMetricsCategory(mFragment));
|
||||
}
|
||||
|
||||
private Intent getFilesIntent() {
|
||||
|
Reference in New Issue
Block a user