Search in sources :

Example 81 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AdvancedPowerUsageDetailActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Intent intent = getIntent();
    final Uri data = intent == null ? null : intent.getData();
    final String packageName = data == null ? null : data.getSchemeSpecificPart();
    if (packageName != null) {
        final Bundle args = new Bundle(4);
        final PackageManager packageManager = getPackageManager();
        args.putString(EXTRA_PACKAGE_NAME, packageName);
        args.putString(EXTRA_POWER_USAGE_PERCENT, Utils.formatPercentage(0));
        if (intent.getBooleanExtra("request_ignore_background_restriction", false)) {
            args.putString(":settings:fragment_args_key", "background_activity");
        }
        try {
            args.putInt(EXTRA_UID, packageManager.getPackageUid(packageName, 0));
        } catch (PackageManager.NameNotFoundException e) {
            Log.w(TAG, "Cannot find package: " + packageName, e);
        }
        new SubSettingLauncher(this).setDestination(AdvancedPowerUsageDetail.class.getName()).setTitleRes(R.string.battery_details_title).setArguments(args).setSourceMetricsCategory(SettingsEnums.APPLICATIONS_INSTALLED_APP_DETAILS).launch();
    }
    finish();
}
Also used : AdvancedPowerUsageDetail(com.android.settings.fuelgauge.AdvancedPowerUsageDetail) PackageManager(android.content.pm.PackageManager) SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) Intent(android.content.Intent) Uri(android.net.Uri)

Example 82 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AdvancedPowerUsageDetail method startBatteryDetailPage.

public static void startBatteryDetailPage(Activity caller, InstrumentedPreferenceFragment fragment, String packageName) {
    final Bundle args = new Bundle(3);
    final PackageManager packageManager = caller.getPackageManager();
    args.putString(EXTRA_PACKAGE_NAME, packageName);
    args.putString(EXTRA_POWER_USAGE_PERCENT, Utils.formatPercentage(0));
    try {
        args.putInt(EXTRA_UID, packageManager.getPackageUid(packageName, 0));
    } catch (PackageManager.NameNotFoundException e) {
        Log.w(TAG, "Cannot find package: " + packageName, e);
    }
    new SubSettingLauncher(caller).setDestination(AdvancedPowerUsageDetail.class.getName()).setTitleRes(R.string.battery_details_title).setArguments(args).setSourceMetricsCategory(fragment.getMetricsCategory()).launch();
}
Also used : PackageManager(android.content.pm.PackageManager) SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle)

Example 83 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class BatteryOptimizationPreferenceController method handlePreferenceTreeClick.

@Override
public boolean handlePreferenceTreeClick(Preference preference) {
    if (!KEY_BACKGROUND_ACTIVITY.equals(preference.getKey())) {
        return false;
    }
    final Bundle args = new Bundle();
    args.putString(ManageApplications.EXTRA_CLASSNAME, Settings.HighPowerApplicationsActivity.class.getName());
    new SubSettingLauncher(mSettingsActivity).setDestination(ManageApplications.class.getName()).setArguments(args).setTitleRes(R.string.high_power_apps).setSourceMetricsCategory(mFragment.getMetricsCategory()).launch();
    return true;
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) ManageApplications(com.android.settings.applications.manageapplications.ManageApplications)

Example 84 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class LockUnificationPreferenceController method ununifyLocks.

private void ununifyLocks() {
    final Bundle extras = new Bundle();
    extras.putInt(Intent.EXTRA_USER_ID, mProfileUserId);
    new SubSettingLauncher(mContext).setDestination(ChooseLockGeneric.ChooseLockGenericFragment.class.getName()).setTitleRes(R.string.lock_settings_picker_title_profile).setSourceMetricsCategory(mHost.getMetricsCategory()).setArguments(extras).launch();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle)

Example 85 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class UserDictionarySettings method showAddOrEditDialog.

/**
 * Add or edit a word. If editingWord is null, it's an add; otherwise, it's an edit.
 *
 * @param editingWord     the word to edit, or null if it's an add.
 * @param editingShortcut the shortcut for this entry, or null if none.
 */
private void showAddOrEditDialog(final String editingWord, final String editingShortcut) {
    final Bundle args = new Bundle();
    args.putInt(UserDictionaryAddWordContents.EXTRA_MODE, null == editingWord ? UserDictionaryAddWordContents.MODE_INSERT : UserDictionaryAddWordContents.MODE_EDIT);
    args.putString(UserDictionaryAddWordContents.EXTRA_WORD, editingWord);
    args.putString(UserDictionaryAddWordContents.EXTRA_SHORTCUT, editingShortcut);
    args.putString(UserDictionaryAddWordContents.EXTRA_LOCALE, mLocale);
    new SubSettingLauncher(getContext()).setDestination(UserDictionaryAddWordFragment.class.getName()).setArguments(args).setTitleRes(R.string.user_dict_settings_add_dialog_title).setSourceMetricsCategory(getMetricsCategory()).launch();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle)

Aggregations

SubSettingLauncher (com.android.settings.core.SubSettingLauncher)135 Bundle (android.os.Bundle)116 Intent (android.content.Intent)24 VisibleForTesting (androidx.annotation.VisibleForTesting)16 Preference (androidx.preference.Preference)14 UserHandle (android.os.UserHandle)10 ManageApplications (com.android.settings.applications.manageapplications.ManageApplications)10 Context (android.content.Context)9 PendingIntent (android.app.PendingIntent)6 PackageManager (android.content.pm.PackageManager)5 ComponentName (android.content.ComponentName)4 PersistableBundle (android.os.PersistableBundle)4 ApplicationsState (com.android.settingslib.applications.ApplicationsState)4 UserManager (android.os.UserManager)3 View (android.view.View)3 NetworkSelectSettings (com.android.settings.network.telephony.NetworkSelectSettings)3 Activity (android.app.Activity)2 NotificationChannel (android.app.NotificationChannel)2 Drawable (android.graphics.drawable.Drawable)2 Uri (android.net.Uri)2