Get rid of direct usage of Utils.onBuildStartFragmentIntent
Change-Id: I87eb97d6da4cd4f99be5bcdb1e3e245eb1c7bd1c Fixes: 73250851 Test: robotests
This commit is contained in:
@@ -35,9 +35,9 @@ import android.util.SparseArray;
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Settings;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.applications.manageapplications.ManageApplications;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settings.deviceinfo.PrivateVolumeSettings.SystemInfoFragment;
|
||||
import com.android.settings.deviceinfo.StorageItemPreference;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
@@ -319,15 +319,12 @@ public class StorageItemPreferenceController extends AbstractPreferenceControlle
|
||||
args.putInt(
|
||||
ManageApplications.EXTRA_STORAGE_TYPE,
|
||||
ManageApplications.STORAGE_TYPE_PHOTOS_VIDEOS);
|
||||
return Utils.onBuildStartFragmentIntent(
|
||||
mContext,
|
||||
ManageApplications.class.getName(),
|
||||
args,
|
||||
null,
|
||||
R.string.storage_photos_videos,
|
||||
null,
|
||||
false,
|
||||
mMetricsFeatureProvider.getMetricsCategory(mFragment));
|
||||
return new SubSettingLauncher(mContext)
|
||||
.setDestination(ManageApplications.class.getName())
|
||||
.setTitle(R.string.storage_photos_videos)
|
||||
.setArguments(args)
|
||||
.setSourceMetricsCategory(mMetricsFeatureProvider.getMetricsCategory(mFragment))
|
||||
.toIntent();
|
||||
}
|
||||
|
||||
private Intent getAudioIntent() {
|
||||
@@ -341,46 +338,57 @@ public class StorageItemPreferenceController extends AbstractPreferenceControlle
|
||||
args.putString(ManageApplications.EXTRA_VOLUME_UUID, mVolume.getFsUuid());
|
||||
args.putString(ManageApplications.EXTRA_VOLUME_NAME, mVolume.getDescription());
|
||||
args.putInt(ManageApplications.EXTRA_STORAGE_TYPE, ManageApplications.STORAGE_TYPE_MUSIC);
|
||||
return Utils.onBuildStartFragmentIntent(mContext,
|
||||
ManageApplications.class.getName(), args, null, R.string.storage_music_audio, null,
|
||||
false, mMetricsFeatureProvider.getMetricsCategory(mFragment));
|
||||
return new SubSettingLauncher(mContext)
|
||||
.setDestination(ManageApplications.class.getName())
|
||||
.setTitle(R.string.storage_music_audio)
|
||||
.setArguments(args)
|
||||
.setSourceMetricsCategory(mMetricsFeatureProvider.getMetricsCategory(mFragment))
|
||||
.toIntent();
|
||||
}
|
||||
|
||||
private Intent getAppsIntent() {
|
||||
if (mVolume == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Bundle args = getWorkAnnotatedBundle(3);
|
||||
final Bundle args = getWorkAnnotatedBundle(3);
|
||||
args.putString(ManageApplications.EXTRA_CLASSNAME,
|
||||
Settings.StorageUseActivity.class.getName());
|
||||
args.putString(ManageApplications.EXTRA_VOLUME_UUID, mVolume.getFsUuid());
|
||||
args.putString(ManageApplications.EXTRA_VOLUME_NAME, mVolume.getDescription());
|
||||
return Utils.onBuildStartFragmentIntent(mContext,
|
||||
ManageApplications.class.getName(), args, null, R.string.apps_storage, null,
|
||||
false, mMetricsFeatureProvider.getMetricsCategory(mFragment));
|
||||
return new SubSettingLauncher(mContext)
|
||||
.setDestination(ManageApplications.class.getName())
|
||||
.setTitle(R.string.apps_storage)
|
||||
.setArguments(args)
|
||||
.setSourceMetricsCategory(mMetricsFeatureProvider.getMetricsCategory(mFragment))
|
||||
.toIntent();
|
||||
}
|
||||
|
||||
private Intent getGamesIntent() {
|
||||
Bundle args = getWorkAnnotatedBundle(1);
|
||||
final Bundle args = getWorkAnnotatedBundle(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));
|
||||
return new SubSettingLauncher(mContext)
|
||||
.setDestination(ManageApplications.class.getName())
|
||||
.setTitle(R.string.game_storage_settings)
|
||||
.setArguments(args)
|
||||
.setSourceMetricsCategory(mMetricsFeatureProvider.getMetricsCategory(mFragment))
|
||||
.toIntent();
|
||||
}
|
||||
|
||||
private Intent getMoviesIntent() {
|
||||
Bundle args = getWorkAnnotatedBundle(1);
|
||||
final Bundle args = getWorkAnnotatedBundle(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));
|
||||
return new SubSettingLauncher(mContext)
|
||||
.setDestination(ManageApplications.class.getName())
|
||||
.setTitle(R.string.storage_movies_tv)
|
||||
.setArguments(args)
|
||||
.setSourceMetricsCategory(mMetricsFeatureProvider.getMetricsCategory(mFragment))
|
||||
.toIntent();
|
||||
}
|
||||
|
||||
private Bundle getWorkAnnotatedBundle(int additionalCapacity) {
|
||||
Bundle args = new Bundle(2 + additionalCapacity);
|
||||
final Bundle args = new Bundle(2 + additionalCapacity);
|
||||
args.putBoolean(ManageApplications.EXTRA_WORK_ONLY, mIsWorkProfile);
|
||||
args.putInt(ManageApplications.EXTRA_WORK_ID, mUserId);
|
||||
return args;
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
package com.android.settings.deviceinfo.storage;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.storage.VolumeInfo;
|
||||
@@ -31,14 +29,16 @@ import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.internal.util.Preconditions;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settings.deviceinfo.StorageItemPreference;
|
||||
import com.android.settings.deviceinfo.StorageProfileFragment;
|
||||
import com.android.settings.wrapper.UserManagerWrapper;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settingslib.drawer.SettingsDrawerActivity;
|
||||
|
||||
/** Defines a {@link AbstractPreferenceController} which handles a single profile of the primary
|
||||
* user. */
|
||||
/**
|
||||
* Defines a {@link AbstractPreferenceController} which handles a single profile of the primary
|
||||
* user.
|
||||
*/
|
||||
public class UserProfileController extends AbstractPreferenceController implements
|
||||
PreferenceControllerMixin, StorageAsyncLoader.ResultHandler,
|
||||
UserIconLoader.UserIconHandler {
|
||||
@@ -79,13 +79,16 @@ public class UserProfileController extends AbstractPreferenceController implemen
|
||||
@Override
|
||||
public boolean handlePreferenceTreeClick(Preference preference) {
|
||||
if (preference != null && mStoragePreference == preference) {
|
||||
Bundle args = new Bundle(2);
|
||||
final Bundle args = new Bundle();
|
||||
args.putInt(StorageProfileFragment.USER_ID_EXTRA, mUser.id);
|
||||
args.putString(VolumeInfo.EXTRA_VOLUME_ID, VolumeInfo.ID_PRIVATE_INTERNAL);
|
||||
Intent intent = Utils.onBuildStartFragmentIntent(mContext,
|
||||
StorageProfileFragment.class.getName(), args, null, 0,
|
||||
mUser.name, false, MetricsProto.MetricsEvent.DEVICEINFO_STORAGE);
|
||||
mContext.startActivity(intent);
|
||||
|
||||
new SubSettingLauncher(mContext)
|
||||
.setDestination(StorageProfileFragment.class.getName())
|
||||
.setArguments(args)
|
||||
.setTitle(mUser.name)
|
||||
.setSourceMetricsCategory(MetricsProto.MetricsEvent.DEVICEINFO_STORAGE)
|
||||
.launch();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -99,8 +102,7 @@ public class UserProfileController extends AbstractPreferenceController implemen
|
||||
int userId = mUser.id;
|
||||
StorageAsyncLoader.AppsStorageResult result = stats.get(userId);
|
||||
if (result != null) {
|
||||
setSize(
|
||||
result.externalStats.totalBytes
|
||||
setSize(result.externalStats.totalBytes
|
||||
+ result.otherAppsSize
|
||||
+ result.videoAppsSize
|
||||
+ result.musicAppsSize
|
||||
|
||||
Reference in New Issue
Block a user