Merge pull request #628 from Skycoder42/master

Correctly extract protected fields from intent (Fixes #627)
This commit is contained in:
PhilippC
2018-12-23 07:27:32 +01:00
committed by GitHub

View File

@@ -6,6 +6,7 @@ import java.util.Iterator;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.json.JSONArray;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
@@ -65,7 +66,16 @@ public abstract class PluginActionBroadcastReceiver extends BroadcastReceiver {
protected String[] getProtectedFieldsListFromIntent() protected String[] getProtectedFieldsListFromIntent()
{ {
return _intent.getStringArrayExtra(Strings.EXTRA_PROTECTED_FIELDS_LIST); try {
JSONArray json = new JSONArray(_intent.getStringExtra(Strings.EXTRA_PROTECTED_FIELDS_LIST));
String[] res = new String[json.length()];
for(int i = 0; i < json.length(); i++)
res[i] = json.getString(i);
return res;
} catch (JSONException e) {
e.printStackTrace();
return null;
}
} }