Search in sources :

Example 21 with SubSettingLauncher

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

the class SliceBuilderUtils method buildSearchResultPageIntent.

public static Intent buildSearchResultPageIntent(Context context, String className, String key, String screenTitle, int sourceMetricsCategory) {
    final Bundle args = new Bundle();
    args.putString(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY, key);
    final Intent searchDestination = new SubSettingLauncher(context).setDestination(className).setArguments(args).setTitleText(screenTitle).setSourceMetricsCategory(sourceMetricsCategory).toIntent();
    searchDestination.putExtra(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY, key).setAction("com.android.settings.SEARCH_RESULT_TRAMPOLINE").setComponent(null);
    return searchDestination;
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent)

Example 22 with SubSettingLauncher

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

the class ChangeProfileScreenLockPreferenceController method handlePreferenceTreeClick.

@Override
public boolean handlePreferenceTreeClick(Preference preference) {
    if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) {
        return false;
    }
    if (Utils.startQuietModeDialogIfNecessary(mContext, mUm, mProfileChallengeUserId)) {
        return false;
    }
    final Bundle extras = new Bundle();
    extras.putInt(Intent.EXTRA_USER_ID, mProfileChallengeUserId);
    new SubSettingLauncher(mContext).setDestination(ChooseLockGeneric.ChooseLockGenericFragment.class.getName()).setTitleRes(R.string.lock_settings_picker_title_profile).setSourceMetricsCategory(mHost.getMetricsCategory()).setArguments(extras).launch();
    return true;
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle)

Example 23 with SubSettingLauncher

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

the class ResetNetwork method showFinalConfirmation.

@VisibleForTesting
void showFinalConfirmation() {
    Bundle args = new Bundle();
    if (mSubscriptions != null && mSubscriptions.size() > 0) {
        int selectedIndex = mSubscriptionSpinner.getSelectedItemPosition();
        SubscriptionInfo subscription = mSubscriptions.get(selectedIndex);
        args.putInt(PhoneConstants.SUBSCRIPTION_KEY, subscription.getSubscriptionId());
    }
    args.putBoolean(MasterClear.ERASE_ESIMS_EXTRA, mEsimContainer.getVisibility() == View.VISIBLE && mEsimCheckbox.isChecked());
    new SubSettingLauncher(getContext()).setDestination(ResetNetworkConfirm.class.getName()).setArguments(args).setTitleRes(R.string.reset_network_confirm_title).setSourceMetricsCategory(getMetricsCategory()).launch();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) SubscriptionInfo(android.telephony.SubscriptionInfo) VisibleForTesting(androidx.annotation.VisibleForTesting)

Example 24 with SubSettingLauncher

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

the class BluetoothDeviceUpdater method launchDeviceDetails.

/**
 * Get {@link CachedBluetoothDevice} from {@link Preference} and it is used to init
 * {@link SubSettingLauncher} to launch {@link BluetoothDeviceDetailsFragment}
 */
protected void launchDeviceDetails(Preference preference) {
    final CachedBluetoothDevice device = ((BluetoothDevicePreference) preference).getBluetoothDevice();
    if (device == null) {
        return;
    }
    final Bundle args = new Bundle();
    args.putString(BluetoothDeviceDetailsFragment.KEY_DEVICE_ADDRESS, device.getDevice().getAddress());
    new SubSettingLauncher(mFragment.getContext()).setDestination(BluetoothDeviceDetailsFragment.class.getName()).setArguments(args).setTitleRes(R.string.device_details_title).setSourceMetricsCategory(mFragment.getMetricsCategory()).launch();
}
Also used : CachedBluetoothDevice(com.android.settingslib.bluetooth.CachedBluetoothDevice) SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle)

Example 25 with SubSettingLauncher

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

the class StorageSettings method refresh.

private synchronized void refresh() {
    final Context context = getPrefContext();
    getPreferenceScreen().removeAll();
    mInternalCategory.removeAll();
    mExternalCategory.removeAll();
    mInternalCategory.addPreference(mInternalSummary);
    final StorageManagerVolumeProvider smvp = new StorageManagerVolumeProvider(mStorageManager);
    final PrivateStorageInfo info = PrivateStorageInfo.getPrivateStorageInfo(smvp);
    final long privateTotalBytes = info.totalBytes;
    final long privateUsedBytes = info.totalBytes - info.freeBytes;
    final List<VolumeInfo> volumes = mStorageManager.getVolumes();
    Collections.sort(volumes, VolumeInfo.getDescriptionComparator());
    for (VolumeInfo vol : volumes) {
        if (vol.getType() == VolumeInfo.TYPE_PRIVATE) {
            if (vol.getState() == VolumeInfo.STATE_UNMOUNTABLE) {
                mInternalCategory.addPreference(new StorageVolumePreference(context, vol, 0));
            } else {
                final long volumeTotalBytes = PrivateStorageInfo.getTotalSize(vol, sTotalInternalStorage);
                mInternalCategory.addPreference(new StorageVolumePreference(context, vol, volumeTotalBytes));
            }
        } else if (vol.getType() == VolumeInfo.TYPE_PUBLIC || vol.getType() == VolumeInfo.TYPE_STUB) {
            mExternalCategory.addPreference(new StorageVolumePreference(context, vol, 0));
        }
    }
    // Show missing private volumes
    final List<VolumeRecord> recs = mStorageManager.getVolumeRecords();
    for (VolumeRecord rec : recs) {
        if (rec.getType() == VolumeInfo.TYPE_PRIVATE && mStorageManager.findVolumeByUuid(rec.getFsUuid()) == null) {
            // TODO: add actual storage type to record
            final Preference pref = new Preference(context);
            pref.setKey(rec.getFsUuid());
            pref.setTitle(rec.getNickname());
            pref.setSummary(com.android.internal.R.string.ext_media_status_missing);
            pref.setIcon(R.drawable.ic_sim_sd);
            mInternalCategory.addPreference(pref);
        }
    }
    // Show unsupported disks to give a chance to init
    final List<DiskInfo> disks = mStorageManager.getDisks();
    for (DiskInfo disk : disks) {
        if (disk.volumeCount == 0 && disk.size > 0) {
            final Preference pref = new Preference(context);
            pref.setKey(disk.getId());
            pref.setTitle(disk.getDescription());
            pref.setSummary(com.android.internal.R.string.ext_media_status_unsupported);
            pref.setIcon(R.drawable.ic_sim_sd);
            mExternalCategory.addPreference(pref);
        }
    }
    final BytesResult result = Formatter.formatBytes(getResources(), privateUsedBytes, 0);
    mInternalSummary.setTitle(TextUtils.expandTemplate(getText(R.string.storage_size_large), result.value, result.units));
    mInternalSummary.setSummary(getString(R.string.storage_volume_used_total, Formatter.formatFileSize(context, privateTotalBytes)));
    if (mInternalCategory.getPreferenceCount() > 0) {
        getPreferenceScreen().addPreference(mInternalCategory);
    }
    if (mExternalCategory.getPreferenceCount() > 0) {
        getPreferenceScreen().addPreference(mExternalCategory);
    }
    if (mInternalCategory.getPreferenceCount() == 2 && mExternalCategory.getPreferenceCount() == 0) {
        // Only showing primary internal storage, so just shortcut
        if (!mHasLaunchedPrivateVolumeSettings) {
            mHasLaunchedPrivateVolumeSettings = true;
            final Bundle args = new Bundle();
            args.putString(VolumeInfo.EXTRA_VOLUME_ID, VolumeInfo.ID_PRIVATE_INTERNAL);
            new SubSettingLauncher(getActivity()).setDestination(StorageDashboardFragment.class.getName()).setArguments(args).setTitleRes(R.string.storage_settings).setSourceMetricsCategory(getMetricsCategory()).launch();
            finish();
        }
    }
}
Also used : Context(android.content.Context) PrivateStorageInfo(com.android.settingslib.deviceinfo.PrivateStorageInfo) Bundle(android.os.Bundle) DiskInfo(android.os.storage.DiskInfo) VolumeInfo(android.os.storage.VolumeInfo) BytesResult(android.text.format.Formatter.BytesResult) VolumeRecord(android.os.storage.VolumeRecord) Preference(androidx.preference.Preference) SubSettingLauncher(com.android.settings.core.SubSettingLauncher) StorageManagerVolumeProvider(com.android.settingslib.deviceinfo.StorageManagerVolumeProvider)

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