[Galaxy S 4 General] vacaloca:
It amazes me the amount of carrier specific restrictions in this file! In fact, the contents of the file below is what was necessary to enable the S4 hidden menus on the VZW Galaxy S4 variant. It should work on other GS4 variants that have the hidden menus disabled.

I got the source below by using the dex2jar tool on HiddenMenu.apk, and then used jad & jd-gui to decompile the class files into Java source code. See here for steps to enable the hidden menus.

qualified class name is: com.android.hiddenmenu.HiddenmenuBroadcastReceiver

package com.android.hiddenmenu;

// <snip imports>

public class HiddenmenuBroadcastReceiver extends BroadcastReceiver
{
public static final boolean IS_DEBUG;
private static String checkMsl;
private static final String cpuCode;
private static final String cpuPreCode;
private static final String gsmsimcode;
private static final String mSalesCode = SystemProperties.get("ro.csc.sales_code", "NONE").trim().toUpperCase();
private static final String model;
private final String DIAG_FLAG = "0";
private String HIDDENMENU_ENABLE_PATH = "/efs/carrier/HiddenMenu";
private final String HIDDEN_MENU_OFF = "OFF";
private final String HIDDEN_MENU_ON = "ON";
private final int HIDDEN_MSL_CODE = 0;
private final int HIDDEN_OTHERS_CODE = 2;
private final int HIDDEN_OTKSL_CODE = 1;

static
{
if (SystemProperties.get("ro.product_ship", "FALSE").trim().toUpperCase().equalsIgnoreCase("TRUE"));
for (boolean bool = false; ; bool = true)
{
IS_DEBUG = bool;
cpuCode = SystemProperties.get("ro.baseband", "NONE").trim().toUpperCase();
cpuPreCode = SystemProperties.get("ro.product.board", "NONE").trim().toUpperCase();
model = SystemProperties.get("ro.product.model", "NONE").trim().toUpperCase();
gsmsimcode = SystemProperties.get("gsm.sim.operator.alpha", "NONE").trim().toUpperCase();
checkMsl = "";
return;
}
}

private boolean checkHiddenMenuEnable()
{
if (new File(this.HIDDENMENU_ENABLE_PATH).exists())
try
{
String str = read(this.HIDDENMENU_ENABLE_PATH);
if (str.equals("ON"))
return true;
boolean bool = str.equals("OFF");
if (bool)
return false;
}
catch (Exception localException)
{
Log.i("HiddenMenu", "Exception in reading file");
}
return false;
}

private static boolean isJigOn()
{
if (new File("/sys/class/sec/switch/adc").exists())
{
String str = readOneLine("/sys/class/sec/switch/adc");
if (IS_DEBUG)
Log.d("HiddenMenu", "JIG: 28");
if (IS_DEBUG)
Log.d("HiddenMenu", "JIG value: " + str);
try
{
if (Integer.parseInt(str, 16) == 28)
{
if (!IS_DEBUG)
break label160;
Log.d("HiddenMenu", "JIG ON");
break label160;
}
boolean bool4 = IS_DEBUG;
bool2 = false;
if (!bool4)
break label162;
Log.d("HiddenMenu", "Wrong value");
return false;
}
catch (Exception localException)
{
boolean bool3 = IS_DEBUG;
bool2 = false;
if (!bool3)
break label162;
}
Log.d("HiddenMenu", "value has unknown");
return false;
}
else
{
boolean bool1 = IS_DEBUG;
bool2 = false;
if (!bool1)
break label162;
Log.d("HiddenMenu", "File Does not Exist!");
return false;
}
label160: boolean bool2 = true;
label162: return bool2;
}

// ERROR //
public static String read(String paramString)
{
// <snip byte code>
// Exception table:
// from	to	target	type
// 67	71	100	java/io/IOException
// 27	43	118	java/lang/Exception
// 140	144	150	java/io/IOException
// 27	43	171	finally
// 120	133	171	finally
// 177	181	184	java/io/IOException
// 50	59	202	finally
// 50	59	209	java/lang/Exception
}

// ERROR //
private static String readOneLine(String paramString)
{
// <snip byte code>
// Exception table:
// from	to	target	type
// 51	56	73	java/io/IOException
// 61	66	73	java/io/IOException
// 7	17	91	java/io/FileNotFoundException
// 110	114	125	java/io/IOException
// 118	122	125	java/io/IOException
// 7	17	143	java/io/IOException
// 162	166	177	java/io/IOException
// 170	174	177	java/io/IOException
// 7	17	195	finally
// 93	106	195	finally
// 145	158	195	finally
// 201	205	216	java/io/IOException
// 209	213	216	java/io/IOException
// 17	31	239	finally
// 36	43	249	finally
// 17	31	260	java/io/IOException
// 36	43	270	java/io/IOException
// 17	31	281	java/io/FileNotFoundException
// 36	43	291	java/io/FileNotFoundException
}

public void onReceive(Context paramContext, Intent paramIntent)
{
Log.i("HiddenMenu", "intent " + paramIntent);
UsbManager localUsbManager = (UsbManager)paramContext.getSystemService("usb");
label162: if (paramIntent.getAction().equals("com.samsung.sec.android.application.csc.chameleon_diag"))
{
String str6 = paramIntent.getStringExtra("String");
Log.i("HiddenMenu", "value is " + str6);
SharedPreferences.Editor localEditor = paramContext.getSharedPreferences("hidden.diagMSLReq.preferences_name", 0).edit();
localEditor.putString("HIDDEN_DIAGMSLREQ", str6);
localEditor.commit();
SharedPreferences localSharedPreferences = paramContext.getSharedPreferences("hidden.diagMSLReq.preferences_name", 0);
Log.i("HiddenMenu", " Hidden menu diagMSLReq - " + localSharedPreferences.getString("HIDDEN_DIAGMSLREQ", "none"));
break label162;
}
Intent localIntent1;
String str1;
String str2;
label309: int i;
while (true)
{
return;
if (paramIntent.getAction().equals("android.provider.Telephony.SECRET_CODE"))
{
localIntent1 = new Intent("android.intent.action.MAIN");
localIntent1.putExtra(CheckHiddenMenu.permissionKey, CheckHiddenMenu.permission);
str1 = paramIntent.getStringExtra("String");
str2 = paramIntent.getData().getHost();
Log.i("HiddenMenu", "intenton " + paramIntent);
Log.i("HiddenMenu", "host is " + str2);
boolean bool4;
label401: int k;
if ("VZW".equalsIgnoreCase(mSalesCode))
{
bool4 = checkHiddenMenuEnable();
if ("DMMODE".equals(str2))
localIntent1.setClass(paramContext, DmMode.class);
}
else
{
if (((mSalesCode.equals("VZW")) || (mSalesCode.equals("USC")) || (mSalesCode.equals("MTR")) || (mSalesCode.equals("XAR"))) && (SystemProperties.get("ro.build.type", "user").trim().equals("user")))
{
if (!"VZW".equals(mSalesCode))
break label725;
if (str2.equals("HIDDENMENUENABLE"))
break;
}
if (str2.equals("4433366335623"))
k = Settings.System.getInt(paramContext.getContentResolver(), "wifi_offload_monitoring", 0);
}
try
{
ContentResolver localContentResolver = paramContext.getContentResolver();
if (k == 0);
for (int m = 1; ; m = 0)
{
Settings.System.putInt(localContentResolver, "wifi_offload_monitoring", m);
if (!str2.equals("DATA"))
break label805;
localIntent1.setClass(paramContext, hdata_options.class);
i = 1;
label474: if (i == 1)
{
localIntent1.setFlags(268435456);
paramContext.startActivity(localIntent1);
}
if (!str2.equals("MSL_OTKSL"))
break;
if ((!str1.equals("433346")) || (!mSalesCode.equalsIgnoreCase("VZW")))
break label3043;
Log.i("HiddenMenu", "enter MSK_OTKSL iot" + str1);
localIntent1.setFlags(268435456);
localIntent1.setClass(paramContext, IOTHiddenMenu.class);
paramContext.startActivity(localIntent1);
return;
if ("setDMMODEMADB".equals(str2))
{
Log.i("HiddenMenu", "Change USB Setting to DM + MODEM + ADB");
localUsbManager.setCurrentFunction("diag,acm,adb", true);
return;
}
if ("setMASSSTORAGE".equals(str2))
{
Log.i("HiddenMenu", "Change USB Setting to setMASSSTORAGE");
localUsbManager.setCurrentFunction("mass_storage", true);
return;
}
if ((!SystemProperties.get("ro.build.type", "user").trim().equals("user")) || (bool4) || ((isJigOn()) && ((str2.equals("TESTMODE")) || (str2.equals("RTN")))))
break label309;
Log.i("HiddenMenu", "is Jig On " + isJigOn());
return;
label725: if (str2.equals("HIDDENMENUENABLE"))
{
localIntent1.setClass(paramContext, HiddenMenuEnable.class);
break label401;
}
if (SystemProperties.get("sys.hiddenmenu.enable", "0").equals("1"))
break label401;
return;
}
}
catch (Exception localException)
{
while (true)
{
Log.e("HiddenMenu", "Error setWifioffloadDebugMode " + localException);
continue;
label805: if (str2.equals("PROGRAM"))
{
localIntent1.setClass(paramContext, ProgramMenu.class);
i = 1;
}
else if (str2.equals("MEID"))
{
String str5 = paramContext.getSharedPreferences("hidden.diagMSLReq.preferences_name", 0).getString("HIDDEN_DIAGMSLREQ", "none");
Log.i("HiddenMenu", "MEID diag Falg" + str5);
i = 0;
if (str5 != null)
{
boolean bool3 = "none".equalsIgnoreCase(str5);
i = 0;
if (!bool3)
{
Intent localIntent2 = new Intent("android.intent.action.MAIN");
localIntent2.setFlags(268435456);
localIntent2.setClass(paramContext, MEIDInfo.class).putExtra(CheckHiddenMenu.permissionKey, CheckHiddenMenu.permission);
paramContext.startActivity(localIntent2);
i = 0;
}
}
}
else if (str2.equals("RTN"))
{
String str4 = paramContext.getSharedPreferences("hidden.diagMSLReq.preferences_name", 0).getString("HIDDEN_DIAGMSLREQ", "none");
localIntent1.setClass(paramContext, RTN.class).putExtra("DIAGFLAG", str4);
i = 1;
}
else if ((str2.equals("CTN")) && ("SCH-I925U".equalsIgnoreCase(model)))
{
localIntent1.setClass(paramContext, CTN.class).putExtra("keyString", str2);
i = 1;
}
else if (str2.equals("LOG"))
{
localIntent1.setClassName("com.sec.android.app.servicemodeapp", "com.sec.android.app.servicemodeapp.SysDump");
i = 1;
}
else if (str2.equals("DEBUG"))
{
if ("SCH-S960L".equalsIgnoreCase(model))
{
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", str2);
i = 1;
}
else if (!mSalesCode.equalsIgnoreCase("VZW"))
{
localIntent1.setClass(paramContext, DebugMenu_Check.class).putExtra("keyString", str2);
i = 1;
}
else
{
localIntent1.setClass(paramContext, DEBUGMENU.class);
i = 1;
}
}
else if (str2.equals("PROG"))
{
localIntent1.setClass(paramContext, TelesPree_Option.class);
i = 1;
}
else if (str2.equals("IOTHIDDENMENU"))
{
localIntent1.setClass(paramContext, IOTHiddenMenu.class);
i = 1;
}
else if (str2.equals("TESTMODE"))
{
Log.i("HiddenMenu", "gsm sim code is" + gsmsimcode + "#" + gsmsimcode.trim() + "#");
if (((mSalesCode.equals("SPR")) || (mSalesCode.equals("VMU"))) && ((gsmsimcode.replaceAll(" ", "").equalsIgnoreCase("BOOSTMOBILE")) || (gsmsimcode.equalsIgnoreCase("VIRGIN"))))
{
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", str2);
i = 1;
}
else if (cpuPreCode.equalsIgnoreCase("MSM7630_SURF"))
{
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", "TESTMODE");
i = 1;
}
else if ((cpuCode.equals("MSM")) || (cpuCode.equalsIgnoreCase("mdm")))
{
Log.i("HiddenMenu", str2);
localIntent1.setClass(paramContext, ServiceModeApp.class).putExtra("keyString", "TESTMODE");
i = 1;
}
else
{
localIntent1.setClass(paramContext, TerminalMode.class).putExtra("keyString", "TESTMODE");
i = 1;
}
}
else if (str2.equals("NAMBASIC"))
{
localIntent1.setClass(paramContext, MSL_option.class);
i = 1;
}
else if (str2.equals("GPSCLRX"))
{
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", str2);
i = 1;
}
else if (str2.equals("SCRTN"))
{
localIntent1.setClass(paramContext, SCRTN.class);
i = 1;
}
else
{
if (!str2.equals("TTY"))
break;
localIntent1.setClass(paramContext, TTY.class);
i = 1;
}
}
if (!str2.equals("PUTIL"))
break label2374;
}
}
}
if (!PhoneUtilSupport.canLaunchUsb());
for (int j = 0; ; j = 1)
{
String str3 = paramContext.getSharedPreferences("hidden.diagMSLReq.preferences_name", 0).getString("HIDDEN_DIAGMSLREQ", "none");
if ("SPH-L720".equalsIgnoreCase(model))
if ("0".equals(str3))
localIntent1.setClass(paramContext, PhoneUtil_Jspr.class);
while (true)
{
i = j;
break;
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", "PhoneUtil_JSPR");
continue;
if ((("BST".equalsIgnoreCase(mSalesCode)) || ("XAS".equalsIgnoreCase(mSalesCode)) || ("mdm".equalsIgnoreCase(cpuCode))) && (!"SPH-D710BST".equalsIgnoreCase(model)))
{
Log.i("HiddenMenu", "For prevail 2 code");
Log.i("HiddenMenu", "diagReq : " + str3);
if ("XAS".equalsIgnoreCase(mSalesCode))
{
if (("SPH-L900".equalsIgnoreCase(model)) || ("SPH-P600".equalsIgnoreCase(model)))
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", "PhoneUtil_Prevail2SPR");
else if ("SPH-L300".equalsIgnoreCase(model))
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", "PhoneUtil_VMU");
else if (("SPH-L500".equalsIgnoreCase(model)) || ("SPH-L720".equalsIgnoreCase(model)))
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", "PhoneUtil_VMU");
else if ((str3.equals("0")) || (str3.equals("none")))
localIntent1.setClass(paramContext, PhoneUtil_Prevail2SPR.class);
else
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", "PhoneUtil_Prevail2SPR");
}
else if ("mdm".equalsIgnoreCase(cpuCode))
{
if ((str3.equals("0")) || (str3.equals("none")))
localIntent1.setClass(paramContext, PhoneUtil.class);
else
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", "PhoneUtil");
}
else
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", "PhoneUtil_Prevail2SPR");
}
else if ("SCH-S960L".equalsIgnoreCase(model))
{
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", str2);
}
else if (("SPH-D710".equalsIgnoreCase(model)) || ("SPH-D710VMUB".equalsIgnoreCase(model)) || ("SPH-D710BST".equalsIgnoreCase(model)) || ("SCH-R760U".equalsIgnoreCase(model)))
{
if (("SPH-D710BST".equalsIgnoreCase(model)) || ("SPH-D710VMUB".equalsIgnoreCase(model)))
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", str2).putExtra("keyString", str2);
else
localIntent1.setClass(paramContext, PhoneUtil_Gaudi.class);
}
else if ("VMU".equalsIgnoreCase(mSalesCode))
{
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", str2).putExtra("keyString", "PhoneUtil_VMU");
}
else if ((cpuCode.equalsIgnoreCase("MSM")) || ("SPR".equalsIgnoreCase(mSalesCode)))
{
if ("SPH-L500".equalsIgnoreCase(model))
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", str2).putExtra("keyString", "PhoneUtil_VMU");
else
localIntent1.setClass(paramContext, PhoneUtil.class);
}
else
{
localIntent1.setClass(paramContext, PhoneUtil_C1vzw.class);
}
}
label2374: if (str2.equals("AKEY"))
{
if ((cpuCode.equals("MSM")) || (cpuCode.equalsIgnoreCase("mdm")))
{
localIntent1.setClass(paramContext, AKEY2.class);
i = 1;
break label474;
}
localIntent1.setClass(paramContext, AKEY2_via.class);
i = 1;
break label474;
}
if (str2.equals("DNSSET"))
{
localIntent1.setClass(paramContext, DNS_Set.class);
i = 1;
break label474;
}
if (str2.equals("DSA"))
{
localIntent1.setClass(paramContext, DSA_Edit.class);
i = 1;
break label474;
}
if (str2.equals("OTATEST"))
{
localIntent1.setClass(paramContext, OTATest.class);
i = 1;
break label474;
}
if (str2.equals("LTEMODE"))
{
localIntent1.setClass(paramContext, LTEMode.class);
i = 1;
break label474;
}
if (str2.equals("CLEAR"))
{
if (("SPR".equalsIgnoreCase(mSalesCode)) || ("SPH-L300".equalsIgnoreCase(model)))
break;
if (!mSalesCode.equalsIgnoreCase("VZW"))
{
localIntent1.setClass(paramContext, DebugMenu_Check.class).putExtra("keyString", str2);
i = 1;
break label474;
}
localIntent1.setClass(paramContext, CLEAR_Reset.class);
i = 1;
break label474;
}
if (str2.equals("setMTP"))
{
Log.i("HiddenMenu", "Change USB Setting to MTP");
localUsbManager.setCurrentFunction("mtp", true);
return;
}
if (str2.equals("setMTPADB"))
{
Log.i("HiddenMenu", "Change USB Setting to MTP + ADB");
localUsbManager.setCurrentFunction("mtp,adb", true);
return;
}
if (str2.equals("setPTP"))
{
Log.i("HiddenMenu", "Change USB Setting to PTP");
localUsbManager.setCurrentFunction("ptp", false);
return;
}
if (str2.equals("setPTPADB"))
{
Log.i("HiddenMenu", "Change USB Setting to RNDIS + ADB");
localUsbManager.setCurrentFunction("ptp,adb", false);
return;
}
if (str2.equals("setRNDISDMMODEM"))
{
Log.i("HiddenMenu", "Change USB Setting to RNDIS + DM + MODEM");
localUsbManager.setCurrentFunction("rndis,acm,diag", true);
return;
}
if (str2.equals("setMASSSTORAGEADB"))
{
Log.i("HiddenMenu", "Change USB Setting to setMASSSTORAGEADB");
localUsbManager.setCurrentFunction("mass_storage,adb", true);
return;
}
if (str2.equals("setMASSSTORAGE"))
{
Log.i("HiddenMenu", "Change USB Setting to setMASSSTORAGE");
localUsbManager.setCurrentFunction("mass_storage", true);
return;
}
if (str2.equals("setRMNETDMMODEM"))
{
Log.i("HiddenMenu", "Change USB Setting to RMNET + DM + MODEM");
localUsbManager.setCurrentFunction("rmnet,acm,diag", true);
return;
}
if (str2.equals("setDMMODEMADB"))
{
Log.i("HiddenMenu", "Change USB Setting to DM + MODEM + ADB");
localUsbManager.setCurrentFunction("diag,acm,adb", true);
return;
}
if ((str2.equals("HIDDENMENUENABLE")) && (SystemProperties.get("ro.build.type", "user").trim().equals("user")))
{
if ("SCH-S960L".equalsIgnoreCase(model))
{
localIntent1.setClass(paramContext, MSL_Checker.class).putExtra("keyString", str2);
i = 1;
break label474;
}
localIntent1.setClass(paramContext, HiddenMenuEnable.class);
i = 1;
break label474;
}
boolean bool1 = str2.equals("DMMODE");
i = 0;
if (!bool1)
break label474;
boolean bool2 = mSalesCode.equals("VZW");
i = 0;
if (!bool2)
break label474;
localIntent1.setClass(paramContext, DmMode.class);
i = 1;
break label474;
label3043: Log.i("HiddenMenu", "enter MSK_OTKSL " + str1);
localIntent1.setClass(paramContext, MSL_Service.class).putExtra("String", str1);
Log.i("HiddenMenu", "set intent : " + localIntent1);
paramContext.startService(localIntent1);
return;
}
}
}