Search in sources :

Example 46 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project android_packages_apps_Settings by omnirom.

the class AccountPreferenceController method onPreferenceClick.

@Override
public boolean onPreferenceClick(Preference preference) {
    final int metricsCategory = mFragment.getMetricsCategory();
    // Check the preference
    final int count = mProfiles.size();
    for (int i = 0; i < count; i++) {
        ProfileData profileData = mProfiles.valueAt(i);
        if (preference == profileData.addAccountPreference) {
            mMetricsFeatureProvider.logClickedPreference(preference, metricsCategory);
            Intent intent = new Intent(ACTION_ADD_ACCOUNT);
            intent.putExtra(EXTRA_USER, profileData.userInfo.getUserHandle());
            intent.putExtra(EXTRA_AUTHORITIES, mAuthorities);
            mContext.startActivity(intent);
            return true;
        }
        if (preference == profileData.removeWorkProfilePreference) {
            mMetricsFeatureProvider.logClickedPreference(preference, metricsCategory);
            final int userId = profileData.userInfo.id;
            RemoveUserFragment.newInstance(userId).show(mFragment.getFragmentManager(), "removeUser");
            return true;
        }
        if (preference == profileData.managedProfilePreference) {
            mMetricsFeatureProvider.logClickedPreference(preference, metricsCategory);
            Bundle arguments = new Bundle();
            arguments.putParcelable(Intent.EXTRA_USER, profileData.userInfo.getUserHandle());
            new SubSettingLauncher(mContext).setSourceMetricsCategory(metricsCategory).setDestination(ManagedProfileSettings.class.getName()).setTitleRes(R.string.managed_profile_settings_title).setArguments(arguments).launch();
            return true;
        }
    }
    return false;
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) Intent(android.content.Intent)

Example 47 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project android_packages_apps_Settings by omnirom.

the class ProcessStatsSummary method onPreferenceClick.

@Override
public boolean onPreferenceClick(Preference preference) {
    if (preference == mAppListPreference) {
        final Bundle args = new Bundle();
        args.putBoolean(ARG_TRANSFER_STATS, true);
        args.putInt(ARG_DURATION_INDEX, mDurationIndex);
        mStatsManager.xferStats();
        new SubSettingLauncher(getContext()).setDestination(ProcessStatsUi.class.getName()).setTitleRes(R.string.memory_usage_apps).setArguments(args).setSourceMetricsCategory(getMetricsCategory()).launch();
        return true;
    }
    return false;
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle)

Example 48 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project android_packages_apps_Settings by omnirom.

the class AppInfoDashboardFragment method startAppInfoFragment.

public static void startAppInfoFragment(Class<?> fragment, int title, Bundle args, SettingsPreferenceFragment caller, AppEntry appEntry) {
    // start new fragment to display extended information
    if (args == null) {
        args = new Bundle();
    }
    args.putString(ARG_PACKAGE_NAME, appEntry.info.packageName);
    args.putInt(ARG_PACKAGE_UID, appEntry.info.uid);
    new SubSettingLauncher(caller.getContext()).setDestination(fragment.getName()).setArguments(args).setTitleRes(title).setResultListener(caller, SUB_INFO_FRAGMENT).setSourceMetricsCategory(caller.getMetricsCategory()).launch();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle)

Example 49 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project android_packages_apps_Settings by omnirom.

the class RunningProcessesView method startServiceDetailsActivity.

// utility method used to start sub activity
private void startServiceDetailsActivity(RunningState.MergedItem mi) {
    if (mOwner != null && mi != null) {
        // start new fragment to display extended information
        Bundle args = new Bundle();
        if (mi.mProcess != null) {
            args.putInt(RunningServiceDetails.KEY_UID, mi.mProcess.mUid);
            args.putString(RunningServiceDetails.KEY_PROCESS, mi.mProcess.mProcessName);
        }
        args.putInt(RunningServiceDetails.KEY_USER_ID, mi.mUserId);
        args.putBoolean(RunningServiceDetails.KEY_BACKGROUND, mAdapter.mShowBackground);
        new SubSettingLauncher(getContext()).setDestination(RunningServiceDetails.class.getName()).setArguments(args).setTitleRes(R.string.runningservicedetails_settings_title).setSourceMetricsCategory(mOwner.getMetricsCategory()).launch();
    }
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle)

Example 50 with SubSettingLauncher

use of com.android.settings.core.SubSettingLauncher in project android_packages_apps_Settings by omnirom.

the class AppInfoBase method startAppInfoFragment.

public static void startAppInfoFragment(Class<?> fragment, int titleRes, String pkg, int uid, Fragment source, int request, int sourceMetricsCategory) {
    final Bundle args = new Bundle();
    args.putString(AppInfoBase.ARG_PACKAGE_NAME, pkg);
    args.putInt(AppInfoBase.ARG_PACKAGE_UID, uid);
    new SubSettingLauncher(source.getContext()).setDestination(fragment.getName()).setSourceMetricsCategory(sourceMetricsCategory).setTitleRes(titleRes).setArguments(args).setUserHandle(new UserHandle(UserHandle.getUserId(uid))).setResultListener(source, request).launch();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) UserHandle(android.os.UserHandle)

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