Update data usage UX
Update the UX and dig the data usage screen out of a huge whole of technical debt. Switch every to use Preferences rather than standard layouts and ListViews. Split data usage into several fragments, all separated. DataUsageSummary: - Shows a summary of the 'default' usage at the top, this will be the default sim on phones, or wifi if it has it, or ethernet as last attempt to show something. - Also has individual categories for each network type that has data, cell, wifi, and ethernet. Maybe should look into bt though? DataUsageList: - Takes a NetworkTemplate as an input, and can only be reached from the network specific categories in DataUsageSummary - Shows a graph of current usage for that network and links to app detail page for any app. - Has gear link to quick get to billing cycle screen if available BillingCycleSettings: - Just a screen with the cycle day and warning/limits separated out from the data usage. AppDataUsage: - App specific data usage details - May need some UX iteration given lack of clarity in the spec Bug: 22459566 Change-Id: I0222d8d7ea7b75a9775207a6026ebbdcce8f5e46
This commit is contained in:
@@ -21,7 +21,6 @@ import android.app.ActivityManager;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.LoaderManager.LoaderCallbacks;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.icu.text.ListFormatter;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
@@ -37,6 +36,7 @@ import android.content.pm.ResolveInfo;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.icu.text.ListFormatter;
|
||||
import android.net.INetworkStatsService;
|
||||
import android.net.INetworkStatsSession;
|
||||
import android.net.NetworkTemplate;
|
||||
@@ -63,16 +63,17 @@ import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.os.BatterySipper;
|
||||
import com.android.internal.os.BatteryStatsHelper;
|
||||
import com.android.settings.AppHeader;
|
||||
import com.android.settings.DataUsageSummary;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.applications.PermissionsSummaryHelper.PermissionsResultCallback;
|
||||
import com.android.settings.datausage.AppDataUsage;
|
||||
import com.android.settings.datausage.DataUsageList;
|
||||
import com.android.settings.datausage.DataUsageSummary;
|
||||
import com.android.settings.fuelgauge.BatteryEntry;
|
||||
import com.android.settings.fuelgauge.PowerUsageDetail;
|
||||
import com.android.settings.notification.AppNotificationSettings;
|
||||
@@ -753,13 +754,7 @@ public class InstalledAppDetails extends AppInfoBase
|
||||
ProcessStatsBase.launchMemoryDetail((SettingsActivity) getActivity(),
|
||||
mStatsManager.getMemInfo(), mStats, false);
|
||||
} else if (preference == mDataPreference) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString(DataUsageSummary.EXTRA_SHOW_APP_IMMEDIATE_PKG,
|
||||
mAppEntry.info.packageName);
|
||||
|
||||
SettingsActivity sa = (SettingsActivity) getActivity();
|
||||
sa.startPreferencePanel(DataUsageSummary.class.getName(), args, -1,
|
||||
getString(R.string.app_data_usage), this, SUB_INFO_FRAGMENT);
|
||||
startAppInfoFragment(AppDataUsage.class, getString(R.string.app_data_usage));
|
||||
} else if (preference == mBatteryPreference) {
|
||||
BatteryEntry entry = new BatteryEntry(getActivity(), null, mUserManager, mSipper);
|
||||
PowerUsageDetail.startBatteryDetailPage((SettingsActivity) getActivity(),
|
||||
@@ -794,7 +789,7 @@ public class InstalledAppDetails extends AppInfoBase
|
||||
}
|
||||
|
||||
public static NetworkTemplate getTemplate(Context context) {
|
||||
if (DataUsageSummary.hasReadyMobileRadio(context)) {
|
||||
if (DataUsageList.hasReadyMobileRadio(context)) {
|
||||
return NetworkTemplate.buildTemplateMobileWildcard();
|
||||
}
|
||||
if (DataUsageSummary.hasWifiRadio(context)) {
|
||||
|
@@ -40,14 +40,13 @@ import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.settings.AppHeader;
|
||||
import com.android.settings.CancellablePreference;
|
||||
import com.android.settings.CancellablePreference.OnCancelListener;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsPreferenceFragment;
|
||||
import com.android.settings.SummaryPreference;
|
||||
import com.android.settings.applications.ProcStatsEntry.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -87,8 +86,6 @@ public class ProcessStatsDetail extends SettingsPreferenceFragment {
|
||||
private long mTotalTime;
|
||||
private long mOnePercentTime;
|
||||
|
||||
private LinearColorBar mColorBar;
|
||||
|
||||
private double mMaxMemoryUsage;
|
||||
|
||||
private double mTotalScale;
|
||||
@@ -177,20 +174,19 @@ public class ProcessStatsDetail extends SettingsPreferenceFragment {
|
||||
mProcGroup = (PreferenceCategory) findPreference(KEY_PROCS);
|
||||
fillProcessesSection();
|
||||
|
||||
LayoutPreference headerLayout = (LayoutPreference) findPreference(KEY_DETAILS_HEADER);
|
||||
SummaryPreference summaryPreference = (SummaryPreference) findPreference(KEY_DETAILS_HEADER);
|
||||
|
||||
// TODO: Find way to share this code with ProcessStatsPreference.
|
||||
boolean statsForeground = mApp.mRunWeight > mApp.mBgWeight;
|
||||
double avgRam = (statsForeground ? mApp.mRunWeight : mApp.mBgWeight) * mWeightToRam;
|
||||
float avgRatio = (float) (avgRam / mMaxMemoryUsage);
|
||||
float remainingRatio = 1 - avgRatio;
|
||||
mColorBar = (LinearColorBar) headerLayout.findViewById(R.id.color_bar);
|
||||
Context context = getActivity();
|
||||
mColorBar.setColors( context.getColor(R.color.memory_max_use), 0,
|
||||
context.getColor(R.color.memory_remaining));
|
||||
mColorBar.setRatios(avgRatio, 0, remainingRatio);
|
||||
((TextView) headerLayout.findViewById(R.id.memory_state)).setText(
|
||||
Formatter.formatShortFileSize(getContext(), (long) avgRam));
|
||||
summaryPreference.setRatios(avgRatio, 0, remainingRatio);
|
||||
Formatter.BytesResult usedResult = Formatter.formatBytes(context.getResources(),
|
||||
(long) avgRam, Formatter.FLAG_SHORTER);
|
||||
summaryPreference.setAmount(usedResult.value);
|
||||
summaryPreference.setUnits(usedResult.units);
|
||||
|
||||
long duration = Math.max(mApp.mRunDuration, mApp.mBgDuration);
|
||||
CharSequence frequency = ProcStatsPackageEntry.getFrequency(duration
|
||||
|
@@ -16,18 +16,15 @@
|
||||
package com.android.settings.applications;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.Preference.OnPreferenceClickListener;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.Formatter;
|
||||
import android.text.format.Formatter.BytesResult;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SummaryPreference;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.applications.ProcStatsData.MemInfo;
|
||||
import com.android.settings.dashboard.SummaryLoader;
|
||||
@@ -42,9 +39,7 @@ public class ProcessStatsSummary extends ProcessStatsBase implements OnPreferenc
|
||||
private static final String KEY_FREE = "free";
|
||||
private static final String KEY_APP_LIST = "apps_list";
|
||||
|
||||
private LinearColorBar mColors;
|
||||
private LayoutPreference mHeader;
|
||||
private TextView mMemStatus;
|
||||
private SummaryPreference mSummaryPref;
|
||||
|
||||
private Preference mPerformance;
|
||||
private Preference mTotalMemory;
|
||||
@@ -57,9 +52,10 @@ public class ProcessStatsSummary extends ProcessStatsBase implements OnPreferenc
|
||||
super.onCreate(icicle);
|
||||
|
||||
addPreferencesFromResource(R.xml.process_stats_summary);
|
||||
mHeader = (LayoutPreference) findPreference(KEY_STATUS_HEADER);
|
||||
mMemStatus = (TextView) mHeader.findViewById(R.id.memory_state);
|
||||
mColors = (LinearColorBar) mHeader.findViewById(R.id.color_bar);
|
||||
mSummaryPref = (SummaryPreference) findPreference(KEY_STATUS_HEADER);
|
||||
int memColor = getContext().getColor(R.color.running_processes_apps_ram);
|
||||
mSummaryPref.setColors(memColor, memColor,
|
||||
getContext().getColor(R.color.running_processes_free_ram));
|
||||
|
||||
mPerformance = findPreference(KEY_PERFORMANCE);
|
||||
mTotalMemory = findPreference(KEY_TOTAL_MEMORY);
|
||||
@@ -72,8 +68,6 @@ public class ProcessStatsSummary extends ProcessStatsBase implements OnPreferenc
|
||||
@Override
|
||||
public void refreshUi() {
|
||||
Context context = getContext();
|
||||
int memColor = context.getColor(R.color.running_processes_apps_ram);
|
||||
mColors.setColors(memColor, memColor, context.getColor(R.color.running_processes_free_ram));
|
||||
|
||||
MemInfo memInfo = mStatsManager.getMemInfo();
|
||||
|
||||
@@ -92,10 +86,10 @@ public class ProcessStatsSummary extends ProcessStatsBase implements OnPreferenc
|
||||
} else {
|
||||
memString = memStatesStr[memStatesStr.length - 1];
|
||||
}
|
||||
mMemStatus.setText(TextUtils.expandTemplate(getText(R.string.storage_size_large),
|
||||
usedResult.value, usedResult.units));
|
||||
mSummaryPref.setAmount(usedResult.value);
|
||||
mSummaryPref.setUnits(usedResult.units);
|
||||
float usedRatio = (float)(usedRam / (freeRam + usedRam));
|
||||
mColors.setRatios(usedRatio, 0, 1 - usedRatio);
|
||||
mSummaryPref.setRatios(usedRatio, 0, 1 - usedRatio);
|
||||
|
||||
mPerformance.setSummary(memString);
|
||||
mTotalMemory.setSummary(totalString);
|
||||
|
Reference in New Issue
Block a user