Merge "Fix work profile storage bugs." into oc-mr1-dev am: 67f0299a25
am: 08fe250704
Change-Id: I8c69cf593d2159c62bbea04d3b85bf65dd944448
This commit is contained in:
@@ -118,6 +118,7 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
||||
public static final String EXTRA_VOLUME_NAME = "volumeName";
|
||||
public static final String EXTRA_STORAGE_TYPE = "storageType";
|
||||
public static final String EXTRA_WORK_ONLY = "workProfileOnly";
|
||||
public static final String EXTRA_WORK_ID = "workId";
|
||||
|
||||
private static final String EXTRA_SORT_ORDER = "sortOrder";
|
||||
private static final String EXTRA_SHOW_SYSTEM = "showSystem";
|
||||
@@ -223,6 +224,8 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
||||
public static final int STORAGE_TYPE_LEGACY = 2; // Show apps even if they can be categorized.
|
||||
public static final int STORAGE_TYPE_PHOTOS_VIDEOS = 3;
|
||||
|
||||
private static final int NO_USER_SPECIFIED = -1;
|
||||
|
||||
// sort order
|
||||
private int mSortOrder = R.id.sort_order_alpha;
|
||||
|
||||
@@ -283,6 +286,7 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
||||
private String mVolumeUuid;
|
||||
private int mStorageType;
|
||||
private boolean mIsWorkOnly;
|
||||
private int mWorkUserId;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -339,6 +343,7 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
||||
}
|
||||
mFilter = getDefaultFilter();
|
||||
mIsWorkOnly = args != null ? args.getBoolean(EXTRA_WORK_ONLY) : false;
|
||||
mWorkUserId = args != null ? args.getInt(EXTRA_WORK_ID) : NO_USER_SPECIFIED;
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
mSortOrder = savedInstanceState.getInt(EXTRA_SORT_ORDER, mSortOrder);
|
||||
@@ -379,13 +384,15 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
||||
mApplications.mHasReceivedBridgeCallback =
|
||||
savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
|
||||
}
|
||||
int userId = mIsWorkOnly ? mWorkUserId : UserHandle.getUserId(mCurrentUid);
|
||||
if (mStorageType == STORAGE_TYPE_MUSIC) {
|
||||
Context context = getContext();
|
||||
mApplications.setExtraViewController(new MusicViewHolderController(
|
||||
context,
|
||||
new StorageStatsSource(context),
|
||||
mVolumeUuid,
|
||||
UserHandle.of(UserHandle.getUserId(mCurrentUid))));
|
||||
mApplications.setExtraViewController(
|
||||
new MusicViewHolderController(
|
||||
context,
|
||||
new StorageStatsSource(context),
|
||||
mVolumeUuid,
|
||||
UserHandle.of(userId)));
|
||||
} else if (mStorageType == STORAGE_TYPE_PHOTOS_VIDEOS) {
|
||||
Context context = getContext();
|
||||
mApplications.setExtraViewController(
|
||||
@@ -393,7 +400,7 @@ public class ManageApplications extends InstrumentedPreferenceFragment
|
||||
context,
|
||||
new StorageStatsSource(context),
|
||||
mVolumeUuid,
|
||||
UserHandle.of(UserHandle.getUserId(mCurrentUid))));
|
||||
UserHandle.of(userId)));
|
||||
}
|
||||
mListView.setAdapter(mApplications);
|
||||
mListView.setRecyclerListener(mApplications);
|
||||
|
Reference in New Issue
Block a user