Show removed user's data usage under its correct item

Users for which UserManager.getUserInfo returned null were shown as
unnamed users on Settings > Data Usage. This behavior has now changed
to show their data usage under the same item as UID_REMOVED.

Bug: 18174376
Change-Id: I8d172647edb51f7a277b4b714e9b7f3a0b5f3154
This commit is contained in:
Zoltan Szatmary-Ban
2014-12-12 18:48:03 +00:00
parent 47a05fc45b
commit cd9b1507fb

View File

@@ -62,6 +62,7 @@ import android.content.Intent;
import android.content.Loader; import android.content.Loader;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.UserInfo;
import android.content.res.Resources; import android.content.res.Resources;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.Color; import android.graphics.Color;
@@ -141,6 +142,7 @@ import com.android.settings.sim.SimSettings;
import com.android.settings.widget.ChartDataUsageView; import com.android.settings.widget.ChartDataUsageView;
import com.android.settings.widget.ChartDataUsageView.DataUsageChartListener; import com.android.settings.widget.ChartDataUsageView.DataUsageChartListener;
import com.android.settings.widget.ChartNetworkSeriesView; import com.android.settings.widget.ChartNetworkSeriesView;
import com.google.android.collect.Lists; import com.google.android.collect.Lists;
import libcore.util.Objects; import libcore.util.Objects;
@@ -1679,9 +1681,16 @@ public class DataUsageSummary extends HighlightingFragment implements Indexable
collapseKey = uid; collapseKey = uid;
category = AppItem.CATEGORY_APP; category = AppItem.CATEGORY_APP;
} else { } else {
// Add to other user item. // If it is a removed user add it to the removed users' key
collapseKey = UidDetailProvider.buildKeyForUser(userId); final UserInfo info = mUm.getUserInfo(userId);
category = AppItem.CATEGORY_USER; if (info == null) {
collapseKey = UID_REMOVED;
category = AppItem.CATEGORY_APP;
} else {
// Add to other user item.
collapseKey = UidDetailProvider.buildKeyForUser(userId);
category = AppItem.CATEGORY_USER;
}
} }
} else if (uid == UID_REMOVED || uid == UID_TETHERING) { } else if (uid == UID_REMOVED || uid == UID_TETHERING) {
collapseKey = uid; collapseKey = uid;