Log source with visibility change
- Add a method in VisibilityLoggerMixin to log visible event using LogMaker, which allows logging additional FIELD_CONTEXT field. - In Utils.startFragment, add current page's metricsCategory as an extra to next page. - In next page's onResume(), extract the previous page's metricsCategory and send it to VisibilityLoggerMixin.visible() - Update all caller with additional paramters Change-Id: I8e1f2597fa465b7d3aa16fa1d21c052a3219694a Fix: 35359289 Test: RunSettingsRoboTests
This commit is contained in:
@@ -35,6 +35,7 @@ import android.os.Bundle;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.SearchIndexableResource;
|
||||
import android.support.v14.preference.PreferenceFragment;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.Preference.OnPreferenceClickListener;
|
||||
import android.support.v7.preference.PreferenceCategory;
|
||||
@@ -88,9 +89,9 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
|
||||
R.string.battery_desc_camera,
|
||||
};
|
||||
|
||||
public static void startBatteryDetailPage(
|
||||
SettingsActivity caller, BatteryStatsHelper helper, int statsType, BatteryEntry entry,
|
||||
boolean showLocationButton, boolean includeAppInfo) {
|
||||
public static void startBatteryDetailPage(SettingsActivity caller,
|
||||
PreferenceFragment fragment, BatteryStatsHelper helper, int statsType,
|
||||
BatteryEntry entry, boolean showLocationButton, boolean includeAppInfo) {
|
||||
// Initialize mStats if necessary.
|
||||
helper.getStats();
|
||||
|
||||
@@ -283,7 +284,7 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
|
||||
args.putIntArray(PowerUsageDetail.EXTRA_DETAIL_TYPES, types);
|
||||
args.putDoubleArray(PowerUsageDetail.EXTRA_DETAIL_VALUES, values);
|
||||
|
||||
caller.startPreferencePanelAsUser(PowerUsageDetail.class.getName(), args,
|
||||
caller.startPreferencePanelAsUser(fragment, PowerUsageDetail.class.getName(), args,
|
||||
R.string.details_title, null, new UserHandle(userId));
|
||||
}
|
||||
|
||||
@@ -550,7 +551,7 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
|
||||
args.putString(InstalledAppDetails.ARG_PACKAGE_NAME, mPackages[0]);
|
||||
|
||||
SettingsActivity sa = (SettingsActivity) getActivity();
|
||||
sa.startPreferencePanel(InstalledAppDetails.class.getName(), args,
|
||||
sa.startPreferencePanel(this, InstalledAppDetails.class.getName(), args,
|
||||
R.string.application_info_label, null, null, 0);
|
||||
}
|
||||
|
||||
@@ -558,26 +559,26 @@ public class PowerUsageDetail extends PowerUsageBase implements Button.OnClickLi
|
||||
SettingsActivity sa = (SettingsActivity)getActivity();
|
||||
switch (action) {
|
||||
case ACTION_DISPLAY_SETTINGS:
|
||||
sa.startPreferencePanel(DisplaySettings.class.getName(), null,
|
||||
sa.startPreferencePanel(this, DisplaySettings.class.getName(), null,
|
||||
R.string.display_settings_title, null, null, 0);
|
||||
break;
|
||||
case ACTION_WIFI_SETTINGS:
|
||||
sa.startPreferencePanel(WifiSettings.class.getName(), null,
|
||||
sa.startPreferencePanel(this, WifiSettings.class.getName(), null,
|
||||
R.string.wifi_settings, null, null, 0);
|
||||
break;
|
||||
case ACTION_BLUETOOTH_SETTINGS:
|
||||
sa.startPreferencePanel(BluetoothSettings.class.getName(), null,
|
||||
sa.startPreferencePanel(this, BluetoothSettings.class.getName(), null,
|
||||
R.string.bluetooth_settings, null, null, 0);
|
||||
break;
|
||||
case ACTION_WIRELESS_SETTINGS:
|
||||
sa.startPreferencePanel(WirelessSettings.class.getName(), null,
|
||||
sa.startPreferencePanel(this, WirelessSettings.class.getName(), null,
|
||||
R.string.radio_controls_title, null, null, 0);
|
||||
break;
|
||||
case ACTION_APP_DETAILS:
|
||||
startApplicationDetailsActivity();
|
||||
break;
|
||||
case ACTION_LOCATION_SETTINGS:
|
||||
sa.startPreferencePanel(LocationSettings.class.getName(), null,
|
||||
sa.startPreferencePanel(this, LocationSettings.class.getName(), null,
|
||||
R.string.location_settings_title, null, null, 0);
|
||||
break;
|
||||
case ACTION_FORCE_STOP:
|
||||
|
||||
@@ -40,7 +40,7 @@ import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.internal.os.BatterySipper;
|
||||
import com.android.internal.os.BatterySipper.DrainType;
|
||||
@@ -141,8 +141,8 @@ public class PowerUsageSummary extends PowerUsageBase {
|
||||
}
|
||||
PowerGaugePreference pgp = (PowerGaugePreference) preference;
|
||||
BatteryEntry entry = pgp.getInfo();
|
||||
PowerUsageDetail.startBatteryDetailPage((SettingsActivity) getActivity(), mStatsHelper,
|
||||
mStatsType, entry, true, true);
|
||||
PowerUsageDetail.startBatteryDetailPage((SettingsActivity) getActivity(), this,
|
||||
mStatsHelper, mStatsType, entry, true, true);
|
||||
return super.onPreferenceTreeClick(preference);
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ public class PowerUsageSummary extends PowerUsageBase {
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ManageApplications.EXTRA_CLASSNAME,
|
||||
HighPowerApplicationsActivity.class.getName());
|
||||
sa.startPreferencePanel(ManageApplications.class.getName(), args,
|
||||
sa.startPreferencePanel(this, ManageApplications.class.getName(), args,
|
||||
R.string.high_power_apps, null, null, 0);
|
||||
return true;
|
||||
case MENU_ADDITIONAL_BATTERY_INFO:
|
||||
@@ -237,7 +237,7 @@ public class PowerUsageSummary extends PowerUsageBase {
|
||||
|
||||
if (featureProvider.isAdvancedUiEnabled()) {
|
||||
Utils.startWithFragment(getContext(), PowerUsageAdvanced.class.getName(), null,
|
||||
null, 0, R.string.advanced_battery_title, null);
|
||||
null, 0, R.string.advanced_battery_title, null, getMetricsCategory());
|
||||
} else {
|
||||
mStatsHelper.storeStatsHistoryInFile(BatteryHistoryDetail.BATTERY_HISTORY_FILE);
|
||||
Bundle args = new Bundle(2);
|
||||
@@ -246,7 +246,7 @@ public class PowerUsageSummary extends PowerUsageBase {
|
||||
args.putParcelable(BatteryHistoryDetail.EXTRA_BROADCAST,
|
||||
mStatsHelper.getBatteryBroadcast());
|
||||
Utils.startWithFragment(getContext(), BatteryHistoryDetail.class.getName(), args,
|
||||
null, 0, R.string.history_details_title, null);
|
||||
null, 0, R.string.history_details_title, null, getMetricsCategory());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user