[Sprint Samsung Galaxy S 4 Q&A, Help & Troubleshoot] autoprime:
Not sure that the HTC One apk will be able to help us. But here's(click here) the apk responsible for the HTC unlock, HtcOMADM_SPCS.apk.

Also included are some Samsung apks I think might be responsible for the unlock, mainly SprintSyncMLSvc.apk. All apks are decompiled with apk tool and converted to jar.

HTC info on unlock:

package com.redbend.vdmc.Sprint;

import android.content.Context;
import com.htc.ipl.common;
import com.htc.omadm.libdo.system.SysLib;
import com.htc.omadm.util.DMLog;
import com.redbend.vdm.NodeIoHandler;
import com.redbend.vdm.VdmException;
import com.redbend.vdm.VdmTree;
import java.nio.ByteBuffer;

public class SIM
{
private static final String LOG_TAG = "SIM";
private static NodeRWCB SIMLOCKRWCB;
public static final String SIMLock = "./SIM/Lock";
private static final int TagID = 15;
private static VdmTree mVdmTree = null;
private static SIM me = null;
private static final String sDisable = "0";
private static final String sEnable = "1";
private TreeHandler hSIMLock;
private common mCommonIPL;
private Context mContext;

private SIM(Context paramContext)
{
this.mContext = paramContext;
}

public static SIM getInstance(Context paramContext)
{
if (me == null)
me = new SIM(paramContext);
return me;
}

public String GetNodeValue(String paramString)
{
try
{
String str = mVdmTree.getStringValue(paramString);
return str;
}
catch (VdmException localVdmException)
{
DMLog.i("SIM", "Failed to get node:" + paramString);
}
return null;
}

public void Register(VdmTree paramVdmTree)
{
mVdmTree = paramVdmTree;
SIMLOCKRWCB = new NodeRWCB();
this.hSIMLock = new TreeHandler(mVdmTree, "./SIM/Lock", SIMLOCKRWCB);
}

public void ReplaceNodeValue(String paramString1, String paramString2)
{
try
{
mVdmTree.replaceStringValue(paramString1, paramString2);
return;
}
catch (VdmException localVdmException)
{
DMLog.i("SIM", "Failed to replace node:" + paramString1);
}
}

public void SyncNodeValue()
{
try
{
mVdmTree.writeToPersistentStorage();
return;
}
catch (VdmException localVdmException)
{
DMLog.i("SIM", "Failed to sync node:");
}
}

public class NodeRWCB
{
public NodeRWCB()
{
}

public int read(int paramInt, byte[] paramArrayOfByte, String paramString)
{
String str = "default";
if (paramString.equals("./SIM/Lock") == true)
{
SIM.access$002(SIM.this, common.getInstance());
if (!SysLib.getSingleton().SIMLockCtl(false, false))
break label115;
}
label115: for (str = "1"; ; str = "0")
{
DMLog.i("SIM", "node:" + paramString + " szData:" + str);
int i = str.length();
if (paramArrayOfByte != null)
{
SIM.this.mCommonIPL.AccessToggle(15, false);
ByteBuffer.wrap(paramArrayOfByte).put(str.getBytes());
}
return i;
}
}

public void write(int paramInt1, byte[] paramArrayOfByte, int paramInt2, String paramString)
{
String str1;
String str2;
if (paramString.equals("./SIM/Lock") == true)
{
str1 = new String(paramArrayOfByte);
SIM.this.mCommonIPL.AccessToggle(15, true);
DMLog.i("SIM", "node:" + paramString + " szData:" + str1);
if (!SysLib.getSingleton().SIMLockCtl(false, false))
break label147;
str2 = "0";
DMLog.i("SIM", "QueryData:" + str2);
if (str1.equals("1") != true)
break label154;
if (str2.equals("1") != true)
{
SysLib.getSingleton().SIMLockCtl(true, false);
com.htc.omadm.prop.PropertyState.bNeedReboot = true;
}
}
label147: label154:
while ((str1.equals("0") != true) || (str2.equals("0") == true))
{
return;
str2 = "1";
break;
}
SysLib.getSingleton().SIMLockCtl(true, true);
com.htc.omadm.prop.PropertyState.bNeedReboot = true;
}
}

public class TreeHandler
implements NodeIoHandler
{
private String mNode;
private SIM.NodeRWCB mRWcb;

public TreeHandler(VdmTree paramString, String paramNodeRWCB, SIM.NodeRWCB arg4)
{
this.mNode = paramNodeRWCB;
Object localObject;
this.mRWcb = localObject;
try
{
paramString.registerNodeIoHandler(paramNodeRWCB, this);
return;
}
catch (VdmException localVdmException)
{
DMLog.i("SIM", "Failed to register node:" + paramNodeRWCB);
}
}

public int read(int paramInt, byte[] paramArrayOfByte)
throws VdmException
{
return this.mRWcb.read(paramInt, paramArrayOfByte, this.mNode);
}

public void write(int paramInt1, byte[] paramArrayOfByte, int paramInt2)
throws VdmException
{
this.mRWcb.write(paramInt1, paramArrayOfByte, paramInt2, this.mNode);
}
}
}

and i think this is related to the samsung unlock

package com.samsung.dmexthandler;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Handler;
import android.os.Message;
import com.samsung.app.util.Logger;
import com.samsung.syncmlport.dm.tslDataStructures.Tsldm_generic_st;
import com.samsung.syncservice.NodeUri;
import com.samsung.syncservice.SyncmlService;

public class SimExternalHandler extends SyncmlDMExternalHandler
{
private static final String LOG_TAG = "SimExternalHandler";
private static final int NOTIFY_WAIT_EXT_HANDLER = 400;
private final Object mCurrentOpLock = new Object();
private Handler mHandler = new Handler()
{
public void handleMessage(Message paramAnonymousMessage)
{
Logger.v("SimExternalHandler", "handleMessage msg.what " + paramAnonymousMessage.what);
switch (paramAnonymousMessage.what)
{
default:
Logger.w("SimExternalHandler", "Unknown msg");
return;
case 400:
}
synchronized (SimExternalHandler.this.mCurrentOpLock)
{
SimExternalHandler.access$102(SimExternalHandler.this, paramAnonymousMessage.arg1);
SimExternalHandler.this.mCurrentOpLock.notifyAll();
return;
}
}
};
private BroadcastReceiver mRilResponseReciever = new BroadcastReceiver()
{
public void onReceive(Context paramAnonymousContext, Intent paramAnonymousIntent)
{
String str = paramAnonymousIntent.getAction();
SimExternalHandler.access$202(SimExternalHandler.this, RilResponseStatus.RESULT_VALID);
Logger.d("SimExternalHandler", "onReceive() : " + str);
Message localMessage = SimExternalHandler.this.mHandler.obtainMessage();
localMessage.what = 400;
if (str.equals("com.samsung.syncservice.SET_SIM_LOCK_RESULT"))
{
int j = paramAnonymousIntent.getIntExtra("result", 0);
Logger.v("SimExternalHandler", "handleMessage setSimLockResponse result is " + j);
localMessage.arg1 = j;
}
while (true)
{
SimExternalHandler.this.mHandler.sendMessage(localMessage);
return;
if (str.equals("com.samsung.syncservice.GET_SIM_LOCK_RESULT"))
if (paramAnonymousIntent.getExtras() == null)
{
SimExternalHandler.access$202(SimExternalHandler.this, RilResponseStatus.RESULT_INVALID);
SimExternalHandler.this.mHandler.sendMessage(localMessage);
Logger.w("SimExternalHandler", "handleMessage mRilResponseValid is false");
}
else if (paramAnonymousIntent.getIntExtra("dataType", 0) == 6)
{
int i = paramAnonymousIntent.getIntExtra("result", 0);
Logger.v("SimExternalHandler", "handleMessage getSimLockResponse result int is " + i);
localMessage.arg1 = i;
}
}
}
};
private int mRilResponseResult = 0;
private RilResponseStatus mRilResponseStatus = RilResponseStatus.NOT_RECEIVED;

public SimExternalHandler(SyncmlService paramSyncmlService)
{
super(paramSyncmlService);
IntentFilter localIntentFilter = new IntentFilter();
localIntentFilter.addAction("com.samsung.syncservice.SET_SIM_LOCK_RESULT");
localIntentFilter.addAction("com.samsung.syncservice.GET_SIM_LOCK_RESULT");
this.mContext.registerReceiver(this.mRilResponseReciever, localIntentFilter);
}

private String getSimLockRil(NodeUri paramNodeUri)
{
Logger.v("SimExternalHandler", "getSimLockValue : uri " + paramNodeUri.uri);
IPhoneDataService localIPhoneDataService = this.mService.getPhoneDataService();
String str = null;
if (localIPhoneDataService != null)
try
{
synchronized (this.mCurrentOpLock)
{
this.mRilResponseStatus = RilResponseStatus.NOT_RECEIVED;
boolean bool = localIPhoneDataService.getSimLock(paramNodeUri.ordinal());
str = null;
if (bool)
{
waitForRilResponse();
RilResponseStatus localRilResponseStatus1 = RilResponseStatus.RESULT_VALID;
RilResponseStatus localRilResponseStatus2 = this.mRilResponseStatus;
str = null;
if (localRilResponseStatus1 == localRilResponseStatus2)
{
Logger.d("SimExternalHandler", "phoneService.getSimLockValue responded " + this.mRilResponseResult);
str = String.valueOf(this.mRilResponseResult);
}
}
return str;
}
}
catch (Exception localException)
{
localException.printStackTrace();
}
return str;
}

private int setSimLockRil(NodeUri paramNodeUri, int paramInt)
{
Logger.v("SimExternalHandler", "setLteParamRil : uri " + paramNodeUri.uri);
IPhoneDataService localIPhoneDataService = this.mService.getPhoneDataService();
int i = 500;
if (localIPhoneDataService != null)
try
{
synchronized (this.mCurrentOpLock)
{
this.mRilResponseStatus = RilResponseStatus.NOT_RECEIVED;
if (localIPhoneDataService.setSimLock(paramNodeUri.ordinal(), paramInt))
{
waitForRilResponse();
if (RilResponseStatus.RESULT_VALID == this.mRilResponseStatus)
{
i = 200;
Logger.d("SimExternalHandler", "phoneService.setSimLockRil responded " + this.mRilResponseResult);
}
}
return i;
}
}
catch (Exception localException)
{
localException.printStackTrace();
}
return i;
}

private void waitForRilResponse()
throws InterruptedException
{
long l = System.currentTimeMillis();
while ((RilResponseStatus.NOT_RECEIVED == this.mRilResponseStatus) && (System.currentTimeMillis() - l < 60000L))
this.mCurrentOpLock.wait();
if (RilResponseStatus.NOT_RECEIVED == this.mRilResponseStatus)
{
Logger.w("SimExternalHandler", "Ril is not reponding within 60 seconds.");
this.mRilResponseStatus = RilResponseStatus.EXPIRED;
}
}

public int getParams(Tsldm_generic_st paramTsldm_generic_st)
{
Logger.v("SimExternalHandler", "getParams : uri " + paramTsldm_generic_st.uri);
NodeUri localNodeUri = NodeUri.fromString(paramTsldm_generic_st.uri);
int i = 3.$SwitchMap$com$samsung$syncservice$NodeUri[localNodeUri.ordinal()];
String str = null;
switch (i)
{
default:
case 1:
case 2:
}
while ((str == null) || (str.equals("")))
{
return 500;
str = getSimLockRil(localNodeUri);
}
if (paramTsldm_generic_st.getDataFormat() == 6)
{
paramTsldm_generic_st.intData = Integer.valueOf(str).intValue();
Logger.d("SimExternalHandler", "getParams int: " + paramTsldm_generic_st.intData);
return 200;
}
paramTsldm_generic_st.charData = str;
paramTsldm_generic_st.charDataLen = paramTsldm_generic_st.charData.length();
Logger.d("SimExternalHandler", "getParams char: " + paramTsldm_generic_st.charData);
return 200;
}

public int replaceParams(Tsldm_generic_st paramTsldm_generic_st)
{
Logger.v("SimExternalHandler", "replaceParams : uri " + paramTsldm_generic_st.uri);
NodeUri localNodeUri = NodeUri.fromString(paramTsldm_generic_st.uri);
switch (3.$SwitchMap$com$samsung$syncservice$NodeUri[localNodeUri.ordinal()])
{
default:
case 1:
case 2:
}
for (int i = 404; ; i = setSimLockRil(localNodeUri, paramTsldm_generic_st.intData))
{
Logger.v("SimExternalHandler", "replaceParams finish ret " + i);
return i;
}
}
}