Bug 852246 - Allow installing over an app with >= version in Android 4.2 via the agent;r=jmaher

This commit is contained in:
William Lachance 2013-03-19 11:58:53 -04:00
Родитель 525e02647c
Коммит 6572a66348
1 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -3317,7 +3317,16 @@ private void CancelNotification()
try
{
pProc = Runtime.getRuntime().exec(this.getSuArgs("pm install -r " + sApp + " Cleanup;exit"));
// on android 4.2 and above, we want to pass the "-d" argument to pm so that version
// downgrades are allowed... (option unsupported in earlier versions)
String sPmCmd;
if (android.os.Build.VERSION.SDK_INT >= 17) { // JELLY_BEAN_MR1
sPmCmd = "pm install -r -d " + sApp + " Cleanup;exit";
} else {
sPmCmd = "pm install -r " + sApp + " Cleanup;exit";
}
pProc = Runtime.getRuntime().exec(this.getSuArgs(sPmCmd));
RedirOutputThread outThrd3 = new RedirOutputThread(pProc, out);
outThrd3.start();
try {