Iteration on multi-user Storage UI.
Now that DefaultContainerService has visibility of external storage for all users, we can measure internal storage in a single pass. Internal storage measurement now iterates across all known users, counting both apps and emulated storage usage. Create MeasurementDetails object with documentation about what is counted under various device configurations. Generalize to measure each Environment.DIRECTORY separately, so it can be combined as needed. General cleanup of how measurements are passed to UI. Bug: 7003520 Change-Id: Ib89c185296a0c9debdc20beeaa98584d803a84e8
This commit is contained in:
@@ -21,34 +21,38 @@ import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ShapeDrawable;
|
||||
import android.graphics.drawable.shapes.RectShape;
|
||||
import android.os.UserHandle;
|
||||
import android.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
public class StorageItemPreference extends Preference {
|
||||
public final int color;
|
||||
public final int userHandle;
|
||||
|
||||
private int mColor = Color.MAGENTA;
|
||||
|
||||
public StorageItemPreference(Context context, String key, int titleRes, int colorRes) {
|
||||
this(context, key, context.getText(titleRes), colorRes);
|
||||
public StorageItemPreference(Context context, int titleRes, int colorRes) {
|
||||
this(context, context.getText(titleRes), colorRes, UserHandle.USER_NULL);
|
||||
}
|
||||
|
||||
public StorageItemPreference(Context context, String key, CharSequence title, int colorRes) {
|
||||
public StorageItemPreference(
|
||||
Context context, CharSequence title, int colorRes, int userHandle) {
|
||||
super(context);
|
||||
//setLayoutResource(R.layout.app_percentage_item);
|
||||
|
||||
if (colorRes != 0) {
|
||||
mColor = context.getResources().getColor(colorRes);
|
||||
this.color = context.getResources().getColor(colorRes);
|
||||
|
||||
final Resources res = context.getResources();
|
||||
final int width = res.getDimensionPixelSize(R.dimen.device_memory_usage_button_width);
|
||||
final int height = res.getDimensionPixelSize(R.dimen.device_memory_usage_button_height);
|
||||
setIcon(createRectShape(width, height, mColor));
|
||||
setIcon(createRectShape(width, height, this.color));
|
||||
} else {
|
||||
this.color = Color.MAGENTA;
|
||||
}
|
||||
|
||||
setKey(key);
|
||||
setTitle(title);
|
||||
setSummary(R.string.memory_calculating_size);
|
||||
|
||||
this.userHandle = userHandle;
|
||||
}
|
||||
|
||||
private static ShapeDrawable createRectShape(int width, int height, int color) {
|
||||
@@ -58,8 +62,4 @@ public class StorageItemPreference extends Preference {
|
||||
shape.getPaint().setColor(color);
|
||||
return shape;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return mColor;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user