Get rid of direct usage of Utils.onBuildStartFragmentIntent

Change-Id: I87eb97d6da4cd4f99be5bcdb1e3e245eb1c7bd1c
Fixes: 73250851
Test: robotests
This commit is contained in:
Fan Zhang
2018-02-19 14:31:50 -08:00
parent 47854c2945
commit 1f6d24a991
14 changed files with 221 additions and 168 deletions

View File

@@ -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