SetupWizard: Fix build after getDefaultDataPhoneId removal

40dfa97392

Change-Id: Ie853c7e789023814c83fed5f318c4910a1169a04
This commit is contained in:
Michael Bestas
2023-10-06 06:59:56 +03:00
committed by Bruno Martins
parent 2e8785ecb9
commit 0ace5b6bd4

View File

@@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2013 The CyanogenMod Project * Copyright (C) 2013 The CyanogenMod Project
* 2017-2022 The LineageOS Project * 2017-2023 The LineageOS Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -88,10 +88,10 @@ public class SetupWizardUtils {
public static void setMobileDataEnabled(Context context, boolean enabled) { public static void setMobileDataEnabled(Context context, boolean enabled) {
TelephonyManager tm = context.getSystemService(TelephonyManager.class); TelephonyManager tm = context.getSystemService(TelephonyManager.class);
if (tm.isMultiSimEnabled()) { if (tm.isMultiSimEnabled()) {
int phoneId = SubscriptionManager.from(context).getDefaultDataPhoneId(); int subId = SubscriptionManager.getDefaultDataSubscriptionId();
int phoneId = SubscriptionManager.from(context).getPhoneId(subId);
android.provider.Settings.Global.putInt(context.getContentResolver(), android.provider.Settings.Global.putInt(context.getContentResolver(),
android.provider.Settings.Global.MOBILE_DATA + phoneId, enabled ? 1 : 0); android.provider.Settings.Global.MOBILE_DATA + phoneId, enabled ? 1 : 0);
int subId = SubscriptionManager.getDefaultDataSubscriptionId();
tm.createForSubscriptionId(subId).setDataEnabled(enabled); tm.createForSubscriptionId(subId).setDataEnabled(enabled);
} else { } else {
android.provider.Settings.Global.putInt(context.getContentResolver(), android.provider.Settings.Global.putInt(context.getContentResolver(),