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
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user