Search in sources :

Example 56 with SubSettingLauncher

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

the class WifiSlice method getWifiEntryAction.

protected SliceAction getWifiEntryAction(WifiSliceItem wifiSliceItem, IconCompat icon, CharSequence title) {
    final int requestCode = wifiSliceItem.getKey().hashCode();
    if (wifiSliceItem.getConnectedState() != WifiEntry.CONNECTED_STATE_DISCONNECTED) {
        final Bundle bundle = new Bundle();
        bundle.putString(WifiNetworkDetailsFragment.KEY_CHOSEN_WIFIENTRY_KEY, wifiSliceItem.getKey());
        final Intent intent = new SubSettingLauncher(mContext).setTitleRes(R.string.pref_title_network_details).setDestination(WifiNetworkDetailsFragment.class.getName()).setArguments(bundle).setSourceMetricsCategory(SettingsEnums.WIFI).toIntent();
        return getActivityAction(requestCode, intent, icon, title);
    }
    if (wifiSliceItem.shouldEditBeforeConnect()) {
        final Intent intent = new Intent(mContext, WifiDialogActivity.class).putExtra(WifiDialogActivity.KEY_CHOSEN_WIFIENTRY_KEY, wifiSliceItem.getKey());
        return getActivityAction(requestCode, intent, icon, title);
    }
    final Intent intent = new Intent(mContext, ConnectToWifiHandler.class).putExtra(ConnectToWifiHandler.KEY_CHOSEN_WIFIENTRY_KEY, wifiSliceItem.getKey()).putExtra(ConnectToWifiHandler.KEY_WIFI_SLICE_URI, getUri());
    return getBroadcastAction(requestCode, intent, icon, title);
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) WifiDialogActivity(com.android.settings.wifi.WifiDialogActivity)

Example 57 with SubSettingLauncher

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

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 58 with SubSettingLauncher

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

the class AdvancedPowerUsageDetail method startBatteryDetailPage.

private static void startBatteryDetailPage(Activity caller, InstrumentedPreferenceFragment fragment, LaunchBatteryDetailPageArgs launchArgs) {
    final Bundle args = new Bundle();
    if (launchArgs.mPackageName == null) {
        // populate data for system app
        args.putString(EXTRA_LABEL, launchArgs.mAppLabel);
        args.putInt(EXTRA_ICON_ID, launchArgs.mIconId);
        args.putString(EXTRA_PACKAGE_NAME, null);
    } else {
        // populate data for normal app
        args.putString(EXTRA_PACKAGE_NAME, launchArgs.mPackageName);
    }
    args.putInt(EXTRA_UID, launchArgs.mUid);
    args.putLong(EXTRA_BACKGROUND_TIME, launchArgs.mBackgroundTimeMs);
    args.putLong(EXTRA_FOREGROUND_TIME, launchArgs.mForegroundTimeMs);
    args.putString(EXTRA_SLOT_TIME, launchArgs.mSlotInformation);
    args.putString(EXTRA_POWER_USAGE_PERCENT, launchArgs.mUsagePercent);
    args.putInt(EXTRA_POWER_USAGE_AMOUNT, launchArgs.mConsumedPower);
    final int userId = launchArgs.mIsUserEntry ? ActivityManager.getCurrentUser() : UserHandle.getUserId(launchArgs.mUid);
    new SubSettingLauncher(caller).setDestination(AdvancedPowerUsageDetail.class.getName()).setTitleRes(R.string.battery_details_title).setArguments(args).setSourceMetricsCategory(fragment.getMetricsCategory()).setUserHandle(new UserHandle(userId)).launch();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle) UserHandle(android.os.UserHandle)

Example 59 with SubSettingLauncher

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

the class UserSettings method openUserDetails.

private void openUserDetails(UserInfo userInfo, boolean newUser) {
    Bundle extras = new Bundle();
    extras.putInt(UserDetailsSettings.EXTRA_USER_ID, userInfo.id);
    extras.putBoolean(AppRestrictionsFragment.EXTRA_NEW_USER, newUser);
    final Context context = getContext();
    SubSettingLauncher launcher = new SubSettingLauncher(context).setDestination(UserDetailsSettings.class.getName()).setArguments(extras).setTitleText(getUserName(context, userInfo)).setSourceMetricsCategory(getMetricsCategory());
    if (mGuestUserAutoCreated && userInfo.isGuest()) {
        launcher.setResultListener(this, REQUEST_EDIT_GUEST);
    }
    launcher.launch();
}
Also used : Context(android.content.Context) SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Bundle(android.os.Bundle)

Example 60 with SubSettingLauncher

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

the class ChannelNotificationSettings method onResume.

@Override
public void onResume() {
    super.onResume();
    if (mUid < 0 || TextUtils.isEmpty(mPkg) || mPkgInfo == null || mChannel == null) {
        Log.w(TAG, "Missing package or uid or packageinfo or channel");
        finish();
        return;
    }
    getActivity().setTitle(mChannel.getName());
    if (!TextUtils.isEmpty(mChannel.getConversationId()) && !mChannel.isDemoted()) {
        Intent intent = new SubSettingLauncher(mContext).setDestination(ConversationNotificationSettings.class.getName()).setArguments(getArguments()).setExtras(getIntent() != null ? getIntent().getExtras() : null).setSourceMetricsCategory(SettingsEnums.NOTIFICATION_TOPIC_NOTIFICATION).toIntent();
        if (mPreferenceFilter != null) {
            intent.setClass(mContext, ChannelPanelActivity.class);
        }
        startActivity(intent);
        finish();
        return;
    }
    for (NotificationPreferenceController controller : mControllers) {
        controller.onResume(mAppRow, mChannel, mChannelGroup, null, null, mSuspendedAppsAdmin, mPreferenceFilter);
        controller.displayPreference(getPreferenceScreen());
    }
    updatePreferenceStates();
    animatePanel();
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) Intent(android.content.Intent)

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