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

Commit 714d7be0 authored by Arc Wang's avatar Arc Wang
Browse files

Fix resource problem in PrivateVolumeForgetTest

Somehow Resource IDs are inconsistent between SettingsLib and
SettingsUnitTests. This is a workaround for NotFoundException
in SettingsUnitTests.

Bug: 183342958
Test: atest com.android.settings.deviceinfo.PrivateVolumeForgetTest
Change-Id: If513d5796d4dcd50261d9dd366f6a0def51e0ec4
parent fef3257d
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -63,7 +63,8 @@ public class MainSwitchBar extends LinearLayout implements CompoundButton.OnChec
            int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);

        LayoutInflater.from(context).inflate(R.layout.main_switch_bar, this);
        LayoutInflater.from(context).inflate(resourceId(context, "layout", "main_switch_bar"),
                this);

        setFocusable(true);
        setClickable(true);
@@ -255,4 +256,8 @@ public class MainSwitchBar extends LinearLayout implements CompoundButton.OnChec

        requestLayout();
    }

    private int resourceId(Context context, String type, String name) {
        return context.getResources().getIdentifier(name, type, context.getPackageName());
    }
}