use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ProcessStatsBase method launchMemoryDetail.
public static void launchMemoryDetail(SettingsActivity activity, MemInfo memInfo, ProcStatsPackageEntry entry, boolean includeAppInfo) {
Bundle args = new Bundle();
args.putParcelable(ProcessStatsDetail.EXTRA_PACKAGE_ENTRY, entry);
args.putDouble(ProcessStatsDetail.EXTRA_WEIGHT_TO_RAM, memInfo.weightToRam);
args.putLong(ProcessStatsDetail.EXTRA_TOTAL_TIME, memInfo.memTotalTime);
args.putDouble(ProcessStatsDetail.EXTRA_MAX_MEMORY_USAGE, memInfo.usedWeight * memInfo.weightToRam);
args.putDouble(ProcessStatsDetail.EXTRA_TOTAL_SCALE, memInfo.totalScale);
new SubSettingLauncher(activity).setDestination(ProcessStatsDetail.class.getName()).setTitleRes(R.string.memory_usage).setArguments(args).setSourceMetricsCategory(Instrumentable.METRICS_CATEGORY_UNKNOWN).launch();
}
use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DataUsageSummaryPreference method launchWifiDataUsage.
@VisibleForTesting
static void launchWifiDataUsage(Context context) {
final Bundle args = new Bundle(1);
args.putParcelable(DataUsageList.EXTRA_NETWORK_TEMPLATE, NetworkTemplate.buildTemplateWifiWildcard());
args.putInt(DataUsageList.EXTRA_NETWORK_TYPE, ConnectivityManager.TYPE_WIFI);
final SubSettingLauncher launcher = new SubSettingLauncher(context).setArguments(args).setDestination(DataUsageList.class.getName()).setSourceMetricsCategory(SettingsEnums.PAGE_UNKNOWN);
launcher.setTitleRes(R.string.wifi_data_usage);
launcher.launch();
}
use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AdvancedPowerUsageDetail method startBatteryDetailPage.
@VisibleForTesting
static void startBatteryDetailPage(Activity caller, BatteryUtils batteryUtils, InstrumentedPreferenceFragment fragment, BatteryStatsHelper helper, int which, BatteryEntry entry, String usagePercent) {
// Initialize mStats if necessary.
helper.getStats();
final Bundle args = new Bundle();
final BatterySipper sipper = entry.sipper;
final BatteryStats.Uid uid = sipper.uidObj;
final boolean isTypeApp = sipper.drainType == BatterySipper.DrainType.APP;
final long foregroundTimeMs = isTypeApp ? batteryUtils.getProcessTimeMs(BatteryUtils.StatusType.FOREGROUND, uid, which) : sipper.usageTimeMs;
final long backgroundTimeMs = isTypeApp ? batteryUtils.getProcessTimeMs(BatteryUtils.StatusType.BACKGROUND, uid, which) : 0;
if (ArrayUtils.isEmpty(sipper.mPackages)) {
// populate data for system app
args.putString(EXTRA_LABEL, entry.getLabel());
args.putInt(EXTRA_ICON_ID, entry.iconId);
args.putString(EXTRA_PACKAGE_NAME, null);
} else {
// populate data for normal app
args.putString(EXTRA_PACKAGE_NAME, entry.defaultPackageName != null ? entry.defaultPackageName : sipper.mPackages[0]);
}
args.putInt(EXTRA_UID, sipper.getUid());
args.putLong(EXTRA_BACKGROUND_TIME, backgroundTimeMs);
args.putLong(EXTRA_FOREGROUND_TIME, foregroundTimeMs);
args.putString(EXTRA_POWER_USAGE_PERCENT, usagePercent);
args.putInt(EXTRA_POWER_USAGE_AMOUNT, (int) sipper.totalPowerMah);
new SubSettingLauncher(caller).setDestination(AdvancedPowerUsageDetail.class.getName()).setTitleRes(R.string.battery_details_title).setArguments(args).setSourceMetricsCategory(fragment.getMetricsCategory()).setUserHandle(new UserHandle(getUserIdToLaunchAdvancePowerUsageDetail(sipper))).launch();
}
use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ZenModeAllBypassingAppsPreferenceController method updateNotificationChannelList.
@VisibleForTesting
void updateNotificationChannelList(List<ApplicationsState.AppEntry> apps) {
if (mPreferenceScreen == null || apps == null) {
return;
}
List<Preference> channelsBypassingDnd = new ArrayList<>();
for (ApplicationsState.AppEntry entry : apps) {
String pkg = entry.info.packageName;
mApplicationsState.ensureIcon(entry);
for (NotificationChannel channel : mNotificationBackend.getNotificationChannelsBypassingDnd(pkg, entry.info.uid).getList()) {
Preference pref = new AppPreference(mPrefContext);
pref.setKey(pkg + "|" + channel.getId());
pref.setTitle(BidiFormatter.getInstance().unicodeWrap(entry.label));
pref.setIcon(entry.icon);
pref.setSummary(BidiFormatter.getInstance().unicodeWrap(channel.getName()));
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Bundle args = new Bundle();
args.putString(AppInfoBase.ARG_PACKAGE_NAME, entry.info.packageName);
args.putInt(AppInfoBase.ARG_PACKAGE_UID, entry.info.uid);
args.putString(Settings.EXTRA_CHANNEL_ID, channel.getId());
new SubSettingLauncher(mContext).setDestination(ChannelNotificationSettings.class.getName()).setArguments(args).setTitleRes(R.string.notification_channel_title).setResultListener(mHostFragment, 0).setSourceMetricsCategory(SettingsEnums.NOTIFICATION_ZEN_MODE_OVERRIDING_APP).launch();
return true;
}
});
channelsBypassingDnd.add(pref);
}
mPreferenceScreen.removeAll();
if (channelsBypassingDnd.size() > 0) {
for (Preference prefToAdd : channelsBypassingDnd) {
mPreferenceScreen.addPreference(prefToAdd);
}
}
}
}
use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ZenCustomRuleConfigSettings method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
mSummaryBuilder = new ZenModeSettings.SummaryBuilder(mContext);
mCallsPreference = getPreferenceScreen().findPreference(CALLS_KEY);
mCallsPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
new SubSettingLauncher(mContext).setDestination(ZenCustomRuleCallsSettings.class.getName()).setArguments(createZenRuleBundle()).setSourceMetricsCategory(SettingsEnums.ZEN_CUSTOM_RULE_CALLS).launch();
return true;
}
});
mMessagesPreference = getPreferenceScreen().findPreference(MESSAGES_KEY);
mMessagesPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
new SubSettingLauncher(mContext).setDestination(ZenCustomRuleMessagesSettings.class.getName()).setArguments(createZenRuleBundle()).setSourceMetricsCategory(SettingsEnums.ZEN_CUSTOM_RULE_MESSAGES).launch();
return true;
}
});
mNotificationsPreference = getPreferenceScreen().findPreference(NOTIFICATIONS_KEY);
mNotificationsPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
new SubSettingLauncher(mContext).setDestination(ZenCustomRuleNotificationsSettings.class.getName()).setArguments(createZenRuleBundle()).setSourceMetricsCategory(SettingsEnums.ZEN_CUSTOM_RULE_NOTIFICATION_RESTRICTIONS).launch();
return true;
}
});
updateSummaries();
}
Aggregations