Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22a1e5b2 authored by Lee Chou's avatar Lee Chou
Browse files

Added check for preference click

handlePreferenceTreeClick gets triggered even for other preferences, so
this check is added to handle the correct click

Bug: 138861284
Test: mp settingsg
Change-Id: I178814b4b194d24f38ad0bb74694a2c51d16c89a
parent 8689f20c
Loading
Loading
Loading
Loading
+16 −11
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Intent;
import android.provider.Settings;
import android.provider.Settings;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionInfo;
import android.telephony.euicc.EuiccManager;
import android.telephony.euicc.EuiccManager;
import android.text.TextUtils;


import androidx.fragment.app.Fragment;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import androidx.preference.Preference;
@@ -60,6 +61,7 @@ public class DeleteSimProfilePreferenceController extends BasePreferenceControll


    @Override
    @Override
    public boolean handlePreferenceTreeClick(Preference preference) {
    public boolean handlePreferenceTreeClick(Preference preference) {
        if (TextUtils.equals(preference.getKey(), getPreferenceKey())) {
            boolean confirmDeletion =
            boolean confirmDeletion =
                    Settings.Global.getInt(
                    Settings.Global.getInt(
                            mContext.getContentResolver(),
                            mContext.getContentResolver(),
@@ -75,6 +77,9 @@ public class DeleteSimProfilePreferenceController extends BasePreferenceControll
            return true;
            return true;
        }
        }


        return false;
    }

    private void deleteSim() {
    private void deleteSim() {
        final Intent intent = new Intent(EuiccManager.ACTION_DELETE_SUBSCRIPTION_PRIVILEGED);
        final Intent intent = new Intent(EuiccManager.ACTION_DELETE_SUBSCRIPTION_PRIVILEGED);
        intent.putExtra(EuiccManager.EXTRA_SUBSCRIPTION_ID, mSubscriptionInfo.getSubscriptionId());
        intent.putExtra(EuiccManager.EXTRA_SUBSCRIPTION_ID, mSubscriptionInfo.getSubscriptionId());