|
16 | 16 |
|
17 | 17 | package openscience.crowdsource.experiments; |
18 | 18 |
|
| 19 | +import android.Manifest; |
19 | 20 | import android.app.AlertDialog; |
20 | 21 | import android.content.DialogInterface; |
21 | 22 | import android.content.Intent; |
@@ -86,10 +87,10 @@ public class MainActivity extends AppCompatActivity implements GLSurfaceView.Ren |
86 | 87 |
|
87 | 88 | String url_sdk = "http://github.com/ctuning/ck"; |
88 | 89 | String url_about = "https://github.com/ctuning/ck/wiki/Advanced_usage_crowdsourcing"; |
89 | | - String url_stats = "http://cTuning.org/crowd-results"; |
90 | | - String url_users = "http://cTuning.org/crowdtuning-timeline"; |
| 90 | + String url_stats = "https://cTuning.org/crowd-results"; |
| 91 | + String url_users = "https://cTuning.org/crowdtuning-timeline"; |
91 | 92 |
|
92 | | - String url_cserver="http://cTuning.org/shared-computing-resources-json/ck.json"; |
| 93 | + String url_cserver="https://cTuning.org/shared-computing-resources-json/ck.json"; |
93 | 94 | String repo_uoa="upload"; |
94 | 95 |
|
95 | 96 | String s_b_start = "Start"; |
@@ -128,6 +129,12 @@ public class MainActivity extends AppCompatActivity implements GLSurfaceView.Ren |
128 | 129 | /*************************************************************************/ |
129 | 130 | @Override |
130 | 131 | protected void onCreate(Bundle savedInstanceState) { |
| 132 | + if (Build.VERSION.SDK_INT>Build.VERSION_CODES.LOLLIPOP_MR1) { |
| 133 | + String[] perms = { Manifest.permission.READ_EXTERNAL_STORAGE, |
| 134 | + Manifest.permission.WRITE_EXTERNAL_STORAGE}; |
| 135 | + requestPermissions(perms, 200); |
| 136 | + } |
| 137 | + |
131 | 138 | super.onCreate(savedInstanceState); |
132 | 139 | setContentView(R.layout.activity_main); |
133 | 140 |
|
@@ -734,63 +741,22 @@ protected String doInBackground(String... arg0) { |
734 | 741 | publishProgress("Detecting some of your platform features ...\n"); |
735 | 742 |
|
736 | 743 | //Get system info ************************************************** |
737 | | - try { |
738 | | - r=openme.read_text_file_and_convert_to_json("/system/build.prop", "=", false, false); |
739 | | - } catch (JSONException e) { |
740 | | - publishProgress("\nError calling OpenME interface (" + e.getMessage() + ") ...\n\n"); |
741 | | - return null; |
742 | | - } |
| 744 | + String model=Build.MODEL; |
| 745 | + String manu=Build.MANUFACTURER; |
743 | 746 |
|
744 | | - try { |
745 | | - if ((Long)r.get("return")>0) |
746 | | - publishProgress("\nProblem during OpenME: "+(String) r.get("error")+"\n\n"); |
747 | | - } catch (JSONException e) { |
748 | | - publishProgress("\nError calling OpenME interface (" + e.getMessage() + ") ...\n\n"); |
749 | | - return null; |
750 | | - } |
| 747 | + if (!model.equals("") && !manu.equals("")) |
| 748 | + if (model.toLowerCase().startsWith(manu.toLowerCase())) |
| 749 | + model=model.substring(manu.length()+1,model.length()); |
751 | 750 |
|
752 | | - String model=""; |
753 | | - String manu=""; |
| 751 | + if (manu.equals("") && !model.equals("")) manu=model; |
754 | 752 |
|
755 | | - JSONObject ra=null; |
| 753 | + manu=manu.toUpperCase(); |
| 754 | + model=model.toUpperCase(); |
756 | 755 |
|
757 | | - try { |
758 | | - ra=(JSONObject) r.get("dict"); |
759 | | - } catch (JSONException e) { |
760 | | - publishProgress("\nError calling OpenME interface (" + e.getMessage() + ") ...\n\n"); |
761 | | - return null; |
762 | | - } |
763 | | - |
764 | | - if (ra!=null) |
765 | | - { |
766 | | - try { |
767 | | - model=(String) ra.get("ro.product.model"); |
768 | | - } catch (JSONException e) { |
769 | | - publishProgress("\nError calling OpenME interface (" + e.getMessage() + ") ...\n\n"); |
770 | | - return null; |
771 | | - } |
772 | | - |
773 | | - try { |
774 | | - manu=(String) ra.get("ro.product.manufacturer"); |
775 | | - } catch (JSONException e) { |
776 | | - publishProgress("\nError calling OpenME interface (" + e.getMessage() + ") ...\n\n"); |
777 | | - return null; |
778 | | - } |
779 | | - |
780 | | - if (!model.equals("") && !manu.equals("")) |
781 | | - if (model.toLowerCase().startsWith(manu.toLowerCase())) |
782 | | - model=model.substring(manu.length()+1,model.length()); |
783 | | - |
784 | | - if (manu.equals("") && !model.equals("")) manu=model; |
785 | | - |
786 | | - manu=manu.toUpperCase(); |
787 | | - model=model.toUpperCase(); |
788 | | - |
789 | | - pf_system=manu; |
790 | | - if (!model.equals("")) pf_system+=' '+model; |
791 | | - pf_system_model=model; |
792 | | - pf_system_vendor=manu; |
793 | | - } |
| 756 | + pf_system=manu; |
| 757 | + if (!model.equals("")) pf_system+=' '+model; |
| 758 | + pf_system_model=model; |
| 759 | + pf_system_vendor=manu; |
794 | 760 |
|
795 | 761 | //Get processor info ************************************************** |
796 | 762 | //It's not yet working properly on heterogeneous CPU, like big/little |
@@ -820,6 +786,8 @@ protected String doInBackground(String... arg0) { |
820 | 786 | } |
821 | 787 | if (processor_file==null) processor_file=""; |
822 | 788 |
|
| 789 | + JSONObject ra=null; |
| 790 | + |
823 | 791 | try { |
824 | 792 | ra=(JSONObject) r.get("dict"); |
825 | 793 | } catch (JSONException e) { |
|
0 commit comments