Merge "Hook up the Games storage category preference to a games view."
This commit is contained in:
@@ -8121,6 +8121,9 @@
|
|||||||
<!-- On status for the automatic storage manager. [CHAR_LIMIT=10] -->
|
<!-- On status for the automatic storage manager. [CHAR_LIMIT=10] -->
|
||||||
<string name="storage_manager_indicator_on">On</string>
|
<string name="storage_manager_indicator_on">On</string>
|
||||||
|
|
||||||
|
<!-- Title of games app storage screen [CHAR LIMIT=30] -->
|
||||||
|
<string name="game_storage_settings">Games</string>
|
||||||
|
|
||||||
<!-- UI webview setting: WebView uninstalled-for-user explanatory text [CHAR LIMIT=30] -->
|
<!-- UI webview setting: WebView uninstalled-for-user explanatory text [CHAR LIMIT=30] -->
|
||||||
<string name="webview_uninstalled_for_user">Uninstalled for user <xliff:g id="user" example="John Doe">%s</xliff:g>\n</string>
|
<string name="webview_uninstalled_for_user">Uninstalled for user <xliff:g id="user" example="John Doe">%s</xliff:g>\n</string>
|
||||||
<!-- UI webview setting: WebView disabled-for-user explanatory text [CHAR LIMIT=30] -->
|
<!-- UI webview setting: WebView disabled-for-user explanatory text [CHAR LIMIT=30] -->
|
||||||
|
@@ -127,6 +127,7 @@ public class Settings extends SettingsActivity {
|
|||||||
public static class OtherSoundSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class OtherSoundSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class ManageDomainUrlsActivity extends SettingsActivity { /* empty */ }
|
public static class ManageDomainUrlsActivity extends SettingsActivity { /* empty */ }
|
||||||
public static class AutomaticStorageManagerSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class AutomaticStorageManagerSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
|
public static class GamesStorageActivity extends SettingsActivity { /* empty */ }
|
||||||
|
|
||||||
public static class TopLevelSettings extends SettingsActivity { /* empty */ }
|
public static class TopLevelSettings extends SettingsActivity { /* empty */ }
|
||||||
public static class ApnSettingsActivity extends SettingsActivity { /* empty */ }
|
public static class ApnSettingsActivity extends SettingsActivity { /* empty */ }
|
||||||
|
@@ -31,7 +31,6 @@ import android.os.LocaleList;
|
|||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.preference.PreferenceFrameLayout;
|
import android.preference.PreferenceFrameLayout;
|
||||||
import android.support.v7.preference.Preference;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -57,6 +56,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
|||||||
import com.android.settings.AppHeader;
|
import com.android.settings.AppHeader;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.Settings.AllApplicationsActivity;
|
import com.android.settings.Settings.AllApplicationsActivity;
|
||||||
|
import com.android.settings.Settings.GamesStorageActivity;
|
||||||
import com.android.settings.Settings.HighPowerApplicationsActivity;
|
import com.android.settings.Settings.HighPowerApplicationsActivity;
|
||||||
import com.android.settings.Settings.ManageExternalSourcesActivity;
|
import com.android.settings.Settings.ManageExternalSourcesActivity;
|
||||||
import com.android.settings.Settings.NotificationAppListActivity;
|
import com.android.settings.Settings.NotificationAppListActivity;
|
||||||
@@ -216,6 +216,7 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
|||||||
public static final int LIST_TYPE_OVERLAY = 6;
|
public static final int LIST_TYPE_OVERLAY = 6;
|
||||||
public static final int LIST_TYPE_WRITE_SETTINGS = 7;
|
public static final int LIST_TYPE_WRITE_SETTINGS = 7;
|
||||||
public static final int LIST_TYPE_MANAGE_SOURCES = 8;
|
public static final int LIST_TYPE_MANAGE_SOURCES = 8;
|
||||||
|
public static final int LIST_TYPE_GAMES = 9;
|
||||||
|
|
||||||
private View mRootView;
|
private View mRootView;
|
||||||
|
|
||||||
@@ -267,6 +268,9 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
|||||||
mListType = LIST_TYPE_WRITE_SETTINGS;
|
mListType = LIST_TYPE_WRITE_SETTINGS;
|
||||||
} else if (className.equals(ManageExternalSourcesActivity.class.getName())) {
|
} else if (className.equals(ManageExternalSourcesActivity.class.getName())) {
|
||||||
mListType = LIST_TYPE_MANAGE_SOURCES;
|
mListType = LIST_TYPE_MANAGE_SOURCES;
|
||||||
|
} else if (className.equals(GamesStorageActivity.class.getName())) {
|
||||||
|
mListType = LIST_TYPE_GAMES;
|
||||||
|
mSortOrder = R.id.sort_order_size;
|
||||||
} else {
|
} else {
|
||||||
mListType = LIST_TYPE_MAIN;
|
mListType = LIST_TYPE_MAIN;
|
||||||
}
|
}
|
||||||
@@ -359,6 +363,9 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
|||||||
if (mListType == LIST_TYPE_STORAGE) {
|
if (mListType == LIST_TYPE_STORAGE) {
|
||||||
mApplications.setOverrideFilter(new VolumeFilter(mVolumeUuid));
|
mApplications.setOverrideFilter(new VolumeFilter(mVolumeUuid));
|
||||||
}
|
}
|
||||||
|
if (mListType == LIST_TYPE_GAMES) {
|
||||||
|
mApplications.setOverrideFilter(ApplicationsState.FILTER_GAMES);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -399,6 +406,7 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
|||||||
case LIST_TYPE_MAIN:
|
case LIST_TYPE_MAIN:
|
||||||
case LIST_TYPE_NOTIFICATION:
|
case LIST_TYPE_NOTIFICATION:
|
||||||
case LIST_TYPE_STORAGE:
|
case LIST_TYPE_STORAGE:
|
||||||
|
case LIST_TYPE_GAMES:
|
||||||
return mSortOrder == R.id.sort_order_alpha;
|
return mSortOrder == R.id.sort_order_alpha;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@@ -413,6 +421,7 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
|||||||
case LIST_TYPE_NOTIFICATION:
|
case LIST_TYPE_NOTIFICATION:
|
||||||
return MetricsEvent.MANAGE_APPLICATIONS_NOTIFICATIONS;
|
return MetricsEvent.MANAGE_APPLICATIONS_NOTIFICATIONS;
|
||||||
case LIST_TYPE_STORAGE:
|
case LIST_TYPE_STORAGE:
|
||||||
|
case LIST_TYPE_GAMES:
|
||||||
return MetricsEvent.APPLICATIONS_STORAGE_APPS;
|
return MetricsEvent.APPLICATIONS_STORAGE_APPS;
|
||||||
case LIST_TYPE_USAGE_ACCESS:
|
case LIST_TYPE_USAGE_ACCESS:
|
||||||
return MetricsEvent.USAGE_ACCESS;
|
return MetricsEvent.USAGE_ACCESS;
|
||||||
@@ -517,6 +526,8 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
|||||||
break;
|
break;
|
||||||
case LIST_TYPE_MANAGE_SOURCES:
|
case LIST_TYPE_MANAGE_SOURCES:
|
||||||
startAppInfoFragment(ExternalSourcesDetails.class, R.string.install_other_apps);
|
startAppInfoFragment(ExternalSourcesDetails.class, R.string.install_other_apps);
|
||||||
|
case LIST_TYPE_GAMES:
|
||||||
|
startAppInfoFragment(AppStorageSettings.class, R.string.game_storage_settings);
|
||||||
break;
|
break;
|
||||||
// TODO: Figure out if there is a way where we can spin up the profile's settings
|
// 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.
|
// process ahead of time, to avoid a long load of data when user clicks on a managed app.
|
||||||
|
@@ -122,7 +122,8 @@ public class StorageItemPreferenceController extends PreferenceController
|
|||||||
intent = getAudioIntent();
|
intent = getAudioIntent();
|
||||||
break;
|
break;
|
||||||
case GAME_KEY:
|
case GAME_KEY:
|
||||||
// TODO: Once app categorization is added, make this section.
|
intent = getGamesIntent();
|
||||||
|
break;
|
||||||
case OTHER_APPS_KEY:
|
case OTHER_APPS_KEY:
|
||||||
// Because we are likely constructed with a null volume, this is theoretically
|
// Because we are likely constructed with a null volume, this is theoretically
|
||||||
// possible.
|
// possible.
|
||||||
@@ -259,6 +260,15 @@ public class StorageItemPreferenceController extends PreferenceController
|
|||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
private Intent getFilesIntent() {
|
private Intent getFilesIntent() {
|
||||||
return mSvp.findEmulatedForPrivate(mVolume).buildBrowseIntent();
|
return mSvp.findEmulatedForPrivate(mVolume).buildBrowseIntent();
|
||||||
}
|
}
|
||||||
|
@@ -140,6 +140,8 @@ public class StorageItemPreferenceControllerTest {
|
|||||||
assertThat(intent.getComponent().getClassName()).isEqualTo(SubSettings.class.getName());
|
assertThat(intent.getComponent().getClassName()).isEqualTo(SubSettings.class.getName());
|
||||||
assertThat(intent.getStringExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT)).isEqualTo(
|
assertThat(intent.getStringExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT)).isEqualTo(
|
||||||
ManageApplications.class.getName());
|
ManageApplications.class.getName());
|
||||||
|
assertThat(intent.getIntExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RESID, 0))
|
||||||
|
.isEqualTo(R.string.apps_storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -158,6 +160,24 @@ public class StorageItemPreferenceControllerTest {
|
|||||||
assertThat(intent.getData()).isEqualTo(browseIntent.getData());
|
assertThat(intent.getData()).isEqualTo(browseIntent.getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testClickGames() {
|
||||||
|
mPreference.setKey("pref_games");
|
||||||
|
mController.handlePreferenceTreeClick(mPreference);
|
||||||
|
|
||||||
|
final ArgumentCaptor<Intent> argumentCaptor = ArgumentCaptor.forClass(Intent.class);
|
||||||
|
verify(mFragment.getActivity()).startActivityAsUser(argumentCaptor.capture(),
|
||||||
|
any(UserHandle.class));
|
||||||
|
|
||||||
|
Intent intent = argumentCaptor.getValue();
|
||||||
|
assertThat(intent.getAction()).isEqualTo(Intent.ACTION_MAIN);
|
||||||
|
assertThat(intent.getComponent().getClassName()).isEqualTo(SubSettings.class.getName());
|
||||||
|
assertThat(intent.getStringExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT)).isEqualTo(
|
||||||
|
ManageApplications.class.getName());
|
||||||
|
assertThat(intent.getIntExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RESID, 0))
|
||||||
|
.isEqualTo(R.string.game_storage_settings);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMeasurementCompletedUpdatesPreferences() {
|
public void testMeasurementCompletedUpdatesPreferences() {
|
||||||
StorageItemPreferenceAlternate audio = new StorageItemPreferenceAlternate(mContext);
|
StorageItemPreferenceAlternate audio = new StorageItemPreferenceAlternate(mContext);
|
||||||
|
Reference in New Issue
Block a user