Skip to content

Commit 60b30a6

Browse files
committed
fixed "access deined" error when detecting platform info on new mobiles with Android 7+ (Samsung S8+, Huawei Mate, etc)
1 parent 2b8e937 commit 60b30a6

File tree

8 files changed

+97
-51
lines changed

8 files changed

+97
-51
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# V2.10
2+
* fixed "access deined" error when detecting platform info
3+
on new mobiles with Android 7+ (Samsung S8+, Huawei Mate, etc)
4+
15
# V2.9
26
* improved layout for smaller displays (800x480)
37
* now supports both TensorFlow and Caffe for ARM64 and ARMV7

COPYRIGHT.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
(C)opyright 2016-2017 dividiti
1+
(C)opyright 2016-2018 dividiti

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2014-2017 dividiti, cTuning foundation and volunteers <info@dividiti.com>
1+
Copyright 2014-2018 dividiti, cTuning foundation and volunteers <info@dividiti.com>
22
All rights reserved
33

44
Redistribution and use in source and binary forms, with or without modification,

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
NEWS
44
====
5+
* We use CK technology to power [open and reproducible ACM ReQuEST tournaments](http://cKnowledge.org/request) on co-design of Pareto-efficient software/hardware stack for deep learning;
6+
* We are building a [collective training set](http://cknowledge.org/repo/web.php?wcid=42b9a1221eb50259:collective_training_set) from user mispredictions and correct labels to improve models
57
* Our collaborative work with ARM was presented at [ARM TechCon'16 (Oct. 27)](http://schedule.armtechcon.com/session/know-your-workloads-design-more-efficient-systems);
68
* ARM uses CK as a front-end for systematic and reproducible benchmarking and tuning of real workloads: [link](https://github.com/ctuning/ck-wa);
79
* Open challenges in computer engineering have been updated: [link](https://github.com/ctuning/ck/wiki/Research-and-development-challenges);
@@ -24,6 +26,7 @@ You can also find public results at [Live CK repo](http://cknowledge.org/repo)!
2426

2527
Public scenarios are prepared using this [CK GitHub repo](https://github.com/ctuning/ck-crowd-scenarios).
2628
Caffe libraries are generated using [CK-Caffe framework](https://github.com/dividiti/ck-caffe).
29+
Collective training set is available [here](http://cknowledge.org/repo/web.php?wcid=42b9a1221eb50259:collective_training_set).
2730

2831
Current scenarios include multi-dimensional and multi-objective
2932
optimization of benchmarks and real workloads such as

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
applicationId "openscience.crowdsource.video.experiments"
99
minSdkVersion 17
1010
targetSdkVersion 22
11-
versionCode 17
12-
versionName "2.9"
11+
versionCode 18
12+
versionName "2.10"
1313
}
1414
buildTypes {
1515
release {

app/src/main/java/openscience/crowdsource/video/experiments/PlatformFeaturesService.java

Lines changed: 83 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
import org.json.JSONException;
77
import org.json.JSONObject;
88

9+
import java.io.BufferedReader;
910
import java.io.File;
11+
import java.io.InputStreamReader;
1012
import java.util.List;
1113

1214
import static openscience.crowdsource.video.experiments.AppConfigService.cachedPlatformFeaturesFilePath;
@@ -137,62 +139,98 @@ public static JSONObject loadPlatformFeaturesFromServer() {
137139
AppLogger.logMessage("Detecting some of your platform features ...\n");
138140

139141
//Get system info **************************************************
140-
try {
141-
r = openme.read_text_file_and_convert_to_json("/system/build.prop", "=", false, false);
142-
} catch (JSONException e) {
143-
AppLogger.logMessage("\nError calling OpenME interface (" + e.getMessage() + ") ...\n\n");
144-
return null;
145-
}
146-
147-
try {
148-
if ((Long) r.get("return") > 0)
149-
AppLogger.logMessage("\nProblem during OpenME: " + (String) r.get("error") + "\n\n");
150-
} catch (JSONException e) {
151-
AppLogger.logMessage("\nError calling OpenME interface (" + e.getMessage() + ") ...\n\n");
152-
return null;
153-
}
142+
Boolean get_system_info=false;
154143

155144
String model = "";
156145
String manu = "";
157146

158-
JSONObject dict = null;
159-
160147
try {
161-
dict = (JSONObject) r.get("dict");
162-
} catch (JSONException e) {
163-
AppLogger.logMessage("\nError calling OpenME interface (" + e.getMessage() + ") ...\n\n");
164-
return null;
148+
r = openme.read_text_file_and_convert_to_json("/system/build.prop", "=", false, false);
149+
get_system_info=true;
150+
} catch (JSONException e) {
151+
// AppLogger.logMessage("\nError calling OpenME interface (" + e.getMessage() + ") ...\n\n");
152+
// return null;
165153
}
166154

167-
if (dict != null) {
168-
try {
169-
model = (String) dict.get("ro.product.model");
170-
} catch (JSONException e) {
171-
AppLogger.logMessage("\nError calling OpenME interface (" + e.getMessage() + ") ...\n\n");
172-
return null;
173-
}
155+
if (get_system_info) {
156+
get_system_info = false;
174157

175158
try {
176-
manu = (String) dict.get("ro.product.manufacturer");
159+
if ((Long) r.get("return") > 0) {
160+
// AppLogger.logMessage("\nProblem during OpenME: " + (String) r.get("error") + "\n\n");
161+
} else {
162+
get_system_info = true;
163+
}
177164
} catch (JSONException e) {
178-
AppLogger.logMessage("\nError calling OpenME interface (" + e.getMessage() + ") ...\n\n");
179-
return null;
165+
// AppLogger.logMessage("\nError calling OpenME interface (" + e.getMessage() + ") ...\n\n");
166+
// return null;
180167
}
181-
182-
if (!model.equals("") && !manu.equals(""))
183-
if (model.toLowerCase().startsWith(manu.toLowerCase()))
184-
model = model.substring(manu.length() + 1, model.length());
185-
186-
if (manu.equals("") && !model.equals("")) manu = model;
187-
188-
manu = manu.toUpperCase();
189-
model = model.toUpperCase();
190-
191-
pf_system = manu;
192-
if (!model.equals("")) pf_system += ' ' + model;
193-
pf_system_model = model;
194-
pf_system_vendor = manu;
195168
}
169+
if (get_system_info) {
170+
JSONObject dict = null;
171+
172+
try {
173+
dict = (JSONObject) r.get("dict");
174+
} catch (JSONException e) {
175+
AppLogger.logMessage("\nError calling OpenME interface (" + e.getMessage() + ") ...\n\n");
176+
return null;
177+
}
178+
179+
if (dict != null) {
180+
try {
181+
model = (String) dict.get("ro.product.model");
182+
} catch (JSONException e) {
183+
AppLogger.logMessage("\nError calling OpenME interface (" + e.getMessage() + ") ...\n\n");
184+
return null;
185+
}
186+
187+
try {
188+
manu = (String) dict.get("ro.product.manufacturer");
189+
} catch (JSONException e) {
190+
AppLogger.logMessage("\nError calling OpenME interface (" + e.getMessage() + ") ...\n\n");
191+
return null;
192+
}
193+
194+
}
195+
}
196+
else {
197+
Process pnew;
198+
BufferedReader readprop;
199+
200+
try {
201+
pnew = Runtime.getRuntime().exec("getprop ro.product.model");
202+
readprop = new BufferedReader(new InputStreamReader(pnew.getInputStream()));
203+
model = readprop.readLine();
204+
pnew.destroy();
205+
} catch (java.io.IOException e) {
206+
AppLogger.logMessage("\nError getting property ro.product.model (" + e.getMessage() + ") ...\n\n");
207+
return null;
208+
}
209+
210+
try {
211+
pnew = Runtime.getRuntime().exec("getprop ro.product.manufacturer");
212+
readprop = new BufferedReader(new InputStreamReader(pnew.getInputStream()));
213+
manu = readprop.readLine();
214+
pnew.destroy();
215+
} catch (java.io.IOException e) {
216+
AppLogger.logMessage("\nError getting property ro.product.manufacturer (" + e.getMessage() + ") ...\n\n");
217+
return null;
218+
}
219+
}
220+
221+
if (!model.equals("") && !manu.equals(""))
222+
if (model.toLowerCase().startsWith(manu.toLowerCase()))
223+
model = model.substring(manu.length() + 1, model.length());
224+
225+
if (manu.equals("") && !model.equals("")) manu = model;
226+
227+
manu = manu.toUpperCase();
228+
model = model.toUpperCase();
229+
230+
pf_system = manu;
231+
if (!model.equals("")) pf_system += ' ' + model;
232+
pf_system_model = model;
233+
pf_system_vendor = manu;
196234

197235
//Get processor info **************************************************
198236
//It's not yet working properly on heterogeneous CPU, like big/little
@@ -213,6 +251,7 @@ public static JSONObject loadPlatformFeaturesFromServer() {
213251
}
214252

215253
String processor_file = null;
254+
JSONObject dict;
216255

217256
try {
218257
processor_file = (String) r.get("file_as_string");

app/src/main/res/layout/activity_info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
android:id="@+id/tv_copyright"
5555
android:layout_width="match_parent"
5656
android:layout_height="wrap_content"
57-
android:text="2016-2017 (с) cTuning foundation and dividiti"
57+
android:text="2016-2018 (с) cTuning foundation and dividiti"
5858
android:textSize="18dp"
5959
android:textAlignment="textStart"
6060
android:textColor="#ffffff"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Mar 06 15:22:59 CET 2017
1+
#Sat Jun 02 10:31:05 CEST 2018
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

0 commit comments

Comments
 (0)