Fix work profile storage bugs.
This makes apps and files in the work profile show up only for the work profile. It turns out the primary profile's user id was getting piped down to the special files views and it was showing the primary profile's file sizes instead of the work ones. Change-Id: If9c175f24920513c624c522d838bcdbe925566d1 Fixes: 65559258, 65558758, 65559934 Test: Settings robotest and 34768986
This commit is contained in:
@@ -20,7 +20,6 @@ import android.app.Fragment;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.TrafficStats;
|
||||
@@ -314,7 +313,7 @@ public class StorageItemPreferenceController extends AbstractPreferenceControlle
|
||||
}
|
||||
|
||||
private Intent getPhotosIntent() {
|
||||
Bundle args = new Bundle(2);
|
||||
Bundle args = getWorkAnnotatedBundle(2);
|
||||
args.putString(
|
||||
ManageApplications.EXTRA_CLASSNAME, Settings.PhotosStorageActivity.class.getName());
|
||||
args.putInt(
|
||||
@@ -336,8 +335,7 @@ public class StorageItemPreferenceController extends AbstractPreferenceControlle
|
||||
return null;
|
||||
}
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean(ManageApplications.EXTRA_WORK_ONLY, mIsWorkProfile);
|
||||
Bundle args = getWorkAnnotatedBundle(4);
|
||||
args.putString(ManageApplications.EXTRA_CLASSNAME,
|
||||
Settings.StorageUseActivity.class.getName());
|
||||
args.putString(ManageApplications.EXTRA_VOLUME_UUID, mVolume.getFsUuid());
|
||||
@@ -353,8 +351,7 @@ public class StorageItemPreferenceController extends AbstractPreferenceControlle
|
||||
return null;
|
||||
}
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean(ManageApplications.EXTRA_WORK_ONLY, mIsWorkProfile);
|
||||
Bundle args = getWorkAnnotatedBundle(3);
|
||||
args.putString(ManageApplications.EXTRA_CLASSNAME,
|
||||
Settings.StorageUseActivity.class.getName());
|
||||
args.putString(ManageApplications.EXTRA_VOLUME_UUID, mVolume.getFsUuid());
|
||||
@@ -365,8 +362,7 @@ public class StorageItemPreferenceController extends AbstractPreferenceControlle
|
||||
}
|
||||
|
||||
private Intent getGamesIntent() {
|
||||
Bundle args = new Bundle(1);
|
||||
args.putBoolean(ManageApplications.EXTRA_WORK_ONLY, mIsWorkProfile);
|
||||
Bundle args = getWorkAnnotatedBundle(1);
|
||||
args.putString(ManageApplications.EXTRA_CLASSNAME,
|
||||
Settings.GamesStorageActivity.class.getName());
|
||||
return Utils.onBuildStartFragmentIntent(mContext,
|
||||
@@ -375,8 +371,7 @@ public class StorageItemPreferenceController extends AbstractPreferenceControlle
|
||||
}
|
||||
|
||||
private Intent getMoviesIntent() {
|
||||
Bundle args = new Bundle(1);
|
||||
args.putBoolean(ManageApplications.EXTRA_WORK_ONLY, mIsWorkProfile);
|
||||
Bundle args = getWorkAnnotatedBundle(1);
|
||||
args.putString(ManageApplications.EXTRA_CLASSNAME,
|
||||
Settings.MoviesStorageActivity.class.getName());
|
||||
return Utils.onBuildStartFragmentIntent(mContext,
|
||||
@@ -384,6 +379,13 @@ public class StorageItemPreferenceController extends AbstractPreferenceControlle
|
||||
null, false, mMetricsFeatureProvider.getMetricsCategory(mFragment));
|
||||
}
|
||||
|
||||
private Bundle getWorkAnnotatedBundle(int additionalCapacity) {
|
||||
Bundle args = new Bundle(2 + additionalCapacity);
|
||||
args.putBoolean(ManageApplications.EXTRA_WORK_ONLY, mIsWorkProfile);
|
||||
args.putInt(ManageApplications.EXTRA_WORK_ID, mUserId);
|
||||
return args;
|
||||
}
|
||||
|
||||
private Intent getFilesIntent() {
|
||||
return mSvp.findEmulatedForPrivate(mVolume).buildBrowseIntent();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user